Pybench I guess.
Diez
But if I assume you know all that and just want to do timings. There
are at least two stdlib functions that can help:
import time
time.time() and time.clock() will give you a wall-clock floating point
number, and you can subtract two of these within the same program to see
how long something takes. This approach ignores interpreter startup,
and does nothing to compensate for other processes running on the
system. But it can be very useful, and easy to run. The resolution on
each function varies by OS, so you may have to experiment to see which
one gives the most precision.
import time
start = time.time()
dotest()
print "Elapsed time", time.time() - start
timeit module can be used within code for timing, or it may be used to
load and run a test from the command line. In the latter version, it
includes the startup time for the interpreter, which might be
important. It also can execute the desired code repeatedly, so you can
get some form of averaging, or amortizing.
*** python -m timeit ....
Note that due to system caching, doing multiple runs consecutively may
give different results than ones that are separated by other programs
running. And of course when you recompile and link., the system buffers
will contain an unusual set of data. So there are ways (which I don't
recall) of flushing the system buffers to let programs start on equal
footing.
DaveA
The Unladen Swallow (sp?) project at code.google.com/????, which looks
to change and speedup CPython, has a suite of benchmarks that are are
perhaps better than PyBench.
Although apparently undocumented, test.pystone is some sort of
interpreter benchmark.
Cheers,
Chris
--
http://blog.rebertia.com
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/