Discrepancy in measuring performance?

Torbjorn Granlund tg at gmplib.org
Tue Apr 3 08:48:07 CEST 2012

Good to hear that you identified the problem!
  p.s. I'm now extra impressed by the speed program for finding a way to
  make itself immune to this.
It is not that strange,

The main problem is the kernel Linux' poor handling of TSC; it should be
saved and restored over interrupts and context switches.  The poor
handling of time and timers is one of the reasons I avoid Linux (but not
GNU, I just avoid Linux and run other kernels).

You run over a long time, making sure you will measure everything that's
going on on the system.  The speed program on the other hand, makes
several separate measurements and filters out measurements that are off.
A single mpn_mul_n takes so little time that no interrupt will usually
have a chance to interfere.


More information about the gmp-discuss mailing list