summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Kathiresan <ganesh3597@gmail.com>2021-03-22 20:57:54 +0530
committerGanesh Kathiresan <ganesh3597@gmail.com>2021-03-22 20:57:54 +0530
commita2c5af9c4f170cd452645a5d938d93ed24f246fa (patch)
tree3ec92c8aa07eba9527f241bf3102a58c72495ce9
parentc78d9a0bb1429f3c4d56d8687ae54cbbe7158838 (diff)
downloadnumpy-a2c5af9c4f170cd452645a5d938d93ed24f246fa.tar.gz
BENCH: Benchmarks for unsigned ints (#18075)
-rw-r--r--benchmarks/benchmarks/bench_ufunc.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/benchmarks/benchmarks/bench_ufunc.py b/benchmarks/benchmarks/bench_ufunc.py
index 13b7382a1..b036581e1 100644
--- a/benchmarks/benchmarks/bench_ufunc.py
+++ b/benchmarks/benchmarks/bench_ufunc.py
@@ -135,18 +135,19 @@ class CustomScalar(Benchmark):
class CustomScalarFloorDivideInt(Benchmark):
- params = ([np.int8, np.int16, np.int32, np.int64], [8, -8, 43, -43, 0])
+ params = (np.sctypes['int'] + np.sctypes['uint'], [8, -8, 43, -43])
param_names = ['dtype', 'divisors']
- max_value = 10**7
- min_value = -10**7
def setup(self, dtype, divisor):
+ if dtype in np.sctypes['uint'] and divisor < 0:
+ raise NotImplementedError(
+ "Skipping test for negative divisor with unsigned type")
+
iinfo = np.iinfo(dtype)
- self.x = np.arange(
- max(iinfo.min, self.min_value),
- min(iinfo.max, self.max_value), dtype=dtype)
+ self.x = np.random.randint(
+ iinfo.min, iinfo.max, size=10000, dtype=dtype)
- def time_floor_divide_int(self, dtpye, divisor):
+ def time_floor_divide_int(self, dtype, divisor):
self.x // divisor