summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2015-10-13 20:21:03 +0300
committerAllan Haldane <allan.haldane@gmail.com>2015-10-18 15:15:40 -0400
commit8cf5b506d2d3da833b09e8bbbe874db6f9c5e809 (patch)
treee685f8303360ae3748842378500d404a7d2c1f8c /benchmarks
parent37382ac4be4139710476aa24cb5ad77fbac70728 (diff)
downloadpython-numpy-8cf5b506d2d3da833b09e8bbbe874db6f9c5e809.tar.gz
python-numpy-8cf5b506d2d3da833b09e8bbbe874db6f9c5e809.tar.bz2
python-numpy-8cf5b506d2d3da833b09e8bbbe874db6f9c5e809.zip
PERF: add 0d structured indexing benchmark
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/benchmarks/bench_indexing.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/benchmarks/benchmarks/bench_indexing.py b/benchmarks/benchmarks/bench_indexing.py
index 4f2482ef8..d6dc4edf0 100644
--- a/benchmarks/benchmarks/bench_indexing.py
+++ b/benchmarks/benchmarks/bench_indexing.py
@@ -47,3 +47,26 @@ class IndexingSeparate(Benchmark):
def time_mmap_fancy_indexing(self):
for i in range(1000):
self.fp[self.indexes]
+
+
+class IndexingStructured0D(Benchmark):
+ def setup(self):
+ self.dt = np.dtype([('a', 'f4', 256)])
+
+ self.A = np.zeros((), self.dt)
+ self.B = self.A.copy()
+
+ self.a = np.zeros(1, self.dt)[0]
+ self.b = self.a.copy()
+
+ def time_array_slice(self):
+ self.B['a'][:] = self.A['a']
+
+ def time_array_all(self):
+ self.B['a'] = self.A['a']
+
+ def time_scalar_slice(self):
+ self.b['a'][:] = self.a['a']
+
+ def time_scalar_all(self):
+ self.b['a'] = self.a['a']