summaryrefslogtreecommitdiff
path: root/benchmarks/creating.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-06-28 01:10:10 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-06-28 01:10:10 +0000
commit145d10cd37fe61c5dcdf1d5841b7d23b09751038 (patch)
tree51369a3ff1fbf60f4c73892ca41ccb946c824b76 /benchmarks/creating.py
parent36c72bfc2118e52160d3445e06b6e1cc17a2cba7 (diff)
downloadnumpy-145d10cd37fe61c5dcdf1d5841b7d23b09751038.tar.gz
Add benchmark for creating new arrays.
Diffstat (limited to 'benchmarks/creating.py')
-rw-r--r--benchmarks/creating.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/benchmarks/creating.py b/benchmarks/creating.py
new file mode 100644
index 000000000..b8bb30f47
--- /dev/null
+++ b/benchmarks/creating.py
@@ -0,0 +1,9 @@
+import timeit
+N = [1000,100]
+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,100)
+print "Numeric: ", t2.repeat(3,100)
+print "Numarray: ", t3.repeat(3,100)