[bash] why is Process Substitution <() so much faster ?!
file allids consists of 300,000 rows, each containing a 5-7 digit numeric id.
file newids consists of 20,000 rows of id's. How do you explain the following timings? time: 0.07s: Code:
diff <(sort allids) <(sort newids) Code:
sort allids >allidssorted Code:
diff allidssorted <(sort newids) |
Quote:
|
Quote:
|
I can't replicate your results:
Code:
~/tmp$ seq 300000 > allids |
For my performance tests I often pipe output into tail while you were redirecting to /dev/null. I noticed that redirecting the diff output took way longer than tail.
When timing the sort, however, sorting to file, /dev/null, or tail made no difference. Anyway, I repeated the tests and I realized that my diff output formatting makes a difference, too: time: 0.07s piped into tail, 0.14s to /dev/null Code:
diff --new-line-format=%L --old-line-format= --unchanged-line-format= allidssorted <(sort newids) Code:
diff allidssorted <(sort newids) time: 0.07s piped into tail, 1.7s to /dev/null Code:
diff <formatting> <(sort allids) <(sort newids) |
All times are GMT -5. The time now is 09:42 AM. |