[Python-Dev] Python Benchmarks

Fredrik Lundh fredrik at pythonware.com
Fri Jun 2 20:52:55 CEST 2006

M.-A. Lemburg wrote:

> I just had an idea: if we could get each test to run
> inside a single time slice assigned by the OS scheduler,
> then we could benefit from the better resolution of the
> hardware timers while still keeping the noise to a
> minimum.
> I suppose this could be achieved by:
> * making sure that each tests needs less than 10ms to run

iirc, very recent linux kernels have a 1 millisecond tick.  so does 
alphas, and probably some other platforms.

> * calling time.sleep(0) after each test run

so some higher priority process can get a chance to run, and spend 9.5 
milliseconds shuffling data to a slow I/O device before blocking? ;-)

I'm not sure this problem can be solved, really, at least not as long as 
you're constrained to portable API:s.

(talking of which, if someone has some time and a linux box to spare, 
and wants to do some serious hacking on precision benchmarks, using


to play with the TSC might be somewhat interesting.)


More information about the Python-Dev mailing list