, 1 min read

Counting to Ten on Linux

Very good article by Bruce Dawson on timing CPU bound application.

Results are:

  1. Using $(expr) to do math is over a hundred times slower than using bash internals. This is not a new discovery, but it’s worth reiterating.
  2. Excessive use of sub processes (see point 1) can confuse the Linux kernel’s power management algorithms, leading to an additional three times slowdown. Interesting…
  3. time gives accurate elapsed time information but its CPU time information should not be trusted, especially if you make excessive use of sub processes (see point 1). Interesting…
  4. When time lies you can always use the Windows Task Manager to measure Linux CPU consumption. Amusing.
  5. Looping in Windows batch files can be faster than looping in Linux shell scripts.
  6. Process creation in Windows is slower than on Linux. Not surprising.