Re:Unix Commands I Abuse Every Day
by ori_b on Wednesday September 05, 2012 @11:00PM
(#4482652)
I was curious, so, here goes; 'foo' was a file of ~1G containing lines made up of of 999 'x's and one '\n'.
This was run from a warm cache, so that the overhead of the extra IO from a pipe would dominate.
[ Parent
| on HN ]
Re:Unix Commands I Abuse Every Day
by dustyleary on Thursday September 06, 2012 @12:43AM
(#4482876)
Both invocations take similiar amounts of "real" time because the task is IO-bound and it takes roughly 1.5s on your machine to read the file.
But if you add up the "user" and "sys" time in the cat example, you see that it took 1.992s of actual cpu-time... Which is actually about a 30% increase in cpu-time spent.
The perf decrease wasn't visible because you have multiple cores parallelizing the extra cpu-time, but it was there.