a small utility for benchmarking
Project description
Benchmarker is a small utility to benchmark your code.
Example (ex.py):
def fib(n): return n <= 2 and 1 or fib(n-1) + fib(n-2) from benchmarker import Benchmarker bm = Benchmarker() # or Benchmarker(width=30, out=sys.stderr, header=True) ## Python 2.5 or later with bm('fib(n) (n==34)'): fib(34) with bm('fib(n) (n==35)'): fib(35) ## Python 2.4 bm('fib(n) (n==34)').run(lambda: fib(34)) bm('fib(n) (n==35)').run(lambda: fib(35))
Output:
$ python ex.py utime stime total real fib(n) (n==34) 4.3700 0.0200 4.3900 4.9449 fib(n) (n==35) 7.1500 0.0500 7.2000 8.0643
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Benchmarker-1.0.0.tar.gz
(8.4 kB
view hashes)
Built Distributions
Benchmarker-1.0.0-py2.7.egg
(4.3 kB
view hashes)
Benchmarker-1.0.0-py2.6.egg
(4.4 kB
view hashes)
Benchmarker-1.0.0-py2.5.egg
(4.3 kB
view hashes)
Benchmarker-1.0.0-py2.4.egg
(4.4 kB
view hashes)