summaryrefslogtreecommitdiff
path: root/benchmarks/simpleindex.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-02-28 18:46:35 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-02-28 18:46:35 -0700
commitd1e6fc3b81bc0557d74771cfffa04af2c62012f7 (patch)
treef3a82f46b98cc82bd4142b1bc71f7f9f8f4bac0c /benchmarks/simpleindex.py
parent0934653e151969f6912c911b5113306bd5f450f1 (diff)
downloadnumpy-d1e6fc3b81bc0557d74771cfffa04af2c62012f7.tar.gz
REM: Remove benchmarks files.
The files are very basic, old benchmarks testing numpy against numeric and numarray. The competitors are almost defunct and, while benchmarks are awesome, we really need a more polished and complete framework that runs against the current competition. I think the early results from these benchmarks were posted, maybe even presented, and could be found in a search. Closes #3088 ;) So old a tuple parameter was used.
Diffstat (limited to 'benchmarks/simpleindex.py')
-rw-r--r--benchmarks/simpleindex.py48
1 files changed, 0 insertions, 48 deletions
diff --git a/benchmarks/simpleindex.py b/benchmarks/simpleindex.py
deleted file mode 100644
index e4e541d96..000000000
--- a/benchmarks/simpleindex.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import timeit
-# This is to show that NumPy is a poorer choice than nested Python lists
-# if you are writing nested for loops.
-# This is slower than Numeric was but Numeric was slower than Python lists were
-# in the first place.
-
-N = 30
-
-code2 = r"""
-for k in xrange(%d):
- for l in xrange(%d):
- res = a[k,l].item() + a[l,k].item()
-""" % (N,N)
-
-code3 = r"""
-for k in xrange(%d):
- for l in xrange(%d):
- res = a[k][l] + a[l][k]
-""" % (N,N)
-
-code = r"""
-for k in xrange(%d):
- for l in xrange(%d):
- res = a[k,l] + a[l,k]
-""" % (N,N)
-
-setup3 = r"""
-import random
-a = [[None for k in xrange(%d)] for l in xrange(%d)]
-for k in xrange(%d):
- for l in xrange(%d):
- a[k][l] = random.random()
-""" % (N,N,N,N)
-
-numpy_timer1 = timeit.Timer(code, 'import numpy as np; a = np.random.rand(%d,%d)' % (N,N))
-numeric_timer = timeit.Timer(code, 'import MLab as np; a=np.rand(%d,%d)' % (N,N))
-numarray_timer = timeit.Timer(code, 'import numarray.mlab as np; a=np.rand(%d,%d)' % (N,N))
-numpy_timer2 = timeit.Timer(code2, 'import numpy as np; a = np.random.rand(%d,%d)' % (N,N))
-python_timer = timeit.Timer(code3, setup3)
-numpy_timer3 = timeit.Timer("res = a + a.transpose()","import numpy as np; a=np.random.rand(%d,%d)" % (N,N))
-
-print "shape = ", (N,N)
-print "NumPy 1: ", numpy_timer1.repeat(3,100)
-print "NumPy 2: ", numpy_timer2.repeat(3,100)
-print "Numeric: ", numeric_timer.repeat(3,100)
-print "Numarray: ", numarray_timer.repeat(3,100)
-print "Python: ", python_timer.repeat(3,100)
-print "Optimized: ", numpy_timer3.repeat(3,100)