From 145d10cd37fe61c5dcdf1d5841b7d23b09751038 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Wed, 28 Jun 2006 01:10:10 +0000 Subject: Add benchmark for creating new arrays. --- benchmarks/creating.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 benchmarks/creating.py (limited to 'benchmarks/creating.py') 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) -- cgit v1.2.1