summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2016-11-29 00:17:52 +0100
committerJulian Taylor <jtaylor.debian@googlemail.com>2017-01-12 17:13:36 +0100
commit7e6091c9a3fc4536ccbadb337e88650b2c901313 (patch)
tree8f7a2c8cc8911f57c1e2f272f9724cc9a3c88bfe /benchmarks
parent95e935fba00a4c49ead235a3694bf62ffdb7240b (diff)
downloadpython-numpy-7e6091c9a3fc4536ccbadb337e88650b2c901313.tar.gz
python-numpy-7e6091c9a3fc4536ccbadb337e88650b2c901313.tar.bz2
python-numpy-7e6091c9a3fc4536ccbadb337e88650b2c901313.zip
TST: add extended packbits tests
Larger data to account for future vectorization. Also add benchmarks for packbits and unpackbits
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/benchmarks/bench_core.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/benchmarks/benchmarks/bench_core.py b/benchmarks/benchmarks/bench_core.py
index 6701917cc..378fc762f 100644
--- a/benchmarks/benchmarks/bench_core.py
+++ b/benchmarks/benchmarks/bench_core.py
@@ -130,3 +130,35 @@ class CountNonzero(Benchmark):
if self.x.ndim >= 2:
np.count_nonzero(self.x, axis=(
self.x.ndim - 1, self.x.ndim - 2))
+
+
+class PackBits(Benchmark):
+ param_names = ['dtype']
+ params = [[np.bool, np.uintp]]
+ def setup(self, dtype):
+ self.d = np.ones(10000, dtype=dtype)
+ self.d2 = np.ones((200, 1000), dtype=dtype)
+
+ def time_packbits(self, dtype):
+ np.packbits(self.d)
+
+ def time_packbits_axis0(self, dtype):
+ np.packbits(self.d2, axis=0)
+
+ def time_packbits_axis1(self, dtype):
+ np.packbits(self.d2, axis=1)
+
+
+class UnpackBits(Benchmark):
+ def setup(self):
+ self.d = np.ones(10000, dtype=np.uint8)
+ self.d2 = np.ones((200, 1000), dtype=np.uint8)
+
+ def time_unpackbits(self):
+ np.unpackbits(self.d)
+
+ def time_unpackbits_axis0(self):
+ np.unpackbits(self.d2, axis=0)
+
+ def time_unpackbits_axis1(self):
+ np.unpackbits(self.d2, axis=1)