summaryrefslogtreecommitdiff
path: root/benchmarks/benchmark.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2007-12-15 18:54:52 +0000
committerTravis Oliphant <oliphant@enthought.com>2007-12-15 18:54:52 +0000
commite76b5fa6896c09257181675bbf4cf47789d32927 (patch)
tree7174e22c68fc47df61e745ee18625ee9f4f5b88c /benchmarks/benchmark.py
parent02ee35a7e1c722a1cdac8f3a60fe9ef7aa079a37 (diff)
downloadnumpy-e76b5fa6896c09257181675bbf4cf47789d32927.tar.gz
Create a branch for io work in NumPy
Diffstat (limited to 'benchmarks/benchmark.py')
-rw-r--r--benchmarks/benchmark.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/benchmarks/benchmark.py b/benchmarks/benchmark.py
deleted file mode 100644
index 59e464686..000000000
--- a/benchmarks/benchmark.py
+++ /dev/null
@@ -1,42 +0,0 @@
-from timeit import Timer
-
-class Benchmark(dict):
- """Benchmark a feature in different modules."""
-
- def __init__(self,modules,title='',runs=3,reps=1000):
- self.module_test = dict((m,'') for m in modules)
- self.runs = runs
- self.reps = reps
- self.title = title
-
- def __setitem__(self,module,(test_str,setup_str)):
- """Set the test code for modules."""
- if module == 'all':
- modules = self.module_test.keys()
- else:
- modules = [module]
-
- for m in modules:
- setup_str = 'import %s; import %s as N; ' % (m,m) \
- + setup_str
- self.module_test[m] = Timer(test_str, setup_str)
-
- def run(self):
- """Run the benchmark on the different modules."""
- module_column_len = max(len(mod) for mod in self.module_test)
-
- if self.title:
- print self.title
- print 'Doing %d runs, each with %d reps.' % (self.runs,self.reps)
- print '-'*79
-
- for mod in sorted(self.module_test):
- modname = mod.ljust(module_column_len)
- try:
- print "%s: %s" % (modname, \
- self.module_test[mod].repeat(self.runs,self.reps))
- except Exception, e:
- print "%s: Failed to benchmark (%s)." % (modname,e)
-
- print '-'*79
- print