Jim Meyering <j...@meyering.net> writes: However, this little command does a lot of I/O, too: 191M input, 77M output. Sure. I've never seen significant variance for such stuff, measurable as CPU time.
I tested with a Sandybridge i3-2120T now. The range takes 32 s. In both cases, the systems run GNU/Linux. The kernel version is 3.2. The factoring speed varies very much with GCC version. I particular the trial division code has a very tight loop, and such loops have more compiler reliance. GCC 4.6 an later generate code that executes 4 insns per (unsuccessful) division. It is also important to use a 32bit binary. We should perhaps have provided better 32-bit code paths to be used for numbers < 2^32 on 32-bit hardware. Now, Pádraig's example needs about 3x more time for a 32-bit binary on the same hardware. -- Torbjörn