diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2007-02-17 18:36:16 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2007-02-17 18:36:16 +0000 |
commit | 5cb3d759d601455e7e94b59d1baaf167782f3544 (patch) | |
tree | fe5b4e0e8939d69fd9fbed8e6c91fc003d94102e /benchmarks/creating.py | |
parent | 70c899f5940d2d2f99acbbc9906064e2028e25f9 (diff) | |
download | numpy-5cb3d759d601455e7e94b59d1baaf167782f3544.tar.gz |
Refactor benchmarks.
Diffstat (limited to 'benchmarks/creating.py')
-rw-r--r-- | benchmarks/creating.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/benchmarks/creating.py b/benchmarks/creating.py index 462d2cd19..981c7fe47 100644 --- a/benchmarks/creating.py +++ b/benchmarks/creating.py @@ -1,9 +1,14 @@ -import timeit +from benchmark import Benchmark + +modules = ['numpy','Numeric','numarray'] + N = [10,10] -t1 = timeit.Timer('a=N.zeros(shape,type)','import numpy as N; shape=%s;type=float'%N) -t2 = timeit.Timer('a=N.zeros(shape,type)','import Numeric as N; shape=%s;type=N.Float'%N) -t3 = timeit.Timer('a=N.zeros(shape,type)',"import numarray as N; shape=%s;type=N.Float"%N) -print "shape = ", N -print "NumPy: ", t1.repeat(3,10000) -print "Numeric: ", t2.repeat(3,10000) -print "Numarray: ", t3.repeat(3,10000) +b = Benchmark(modules, + title='Creating %s zeros.' % N, + runs=3,reps=10000) + +b['numpy'] = ('a=N.zeros(shape,type)', 'shape=%s;type=float' % N) +b['Numeric'] = ('a=N.zeros(shape,type)', 'shape=%s;type=N.Float' % N) +b['numarray'] = ('a=N.zeros(shape,type)', "shape=%s;type=N.Float" % N) + +b.run() |