diff options
| author | Ganesh Kathiresan <ganesh3597@gmail.com> | 2020-11-23 14:42:35 +0530 |
|---|---|---|
| committer | Ganesh Kathiresan <ganesh3597@gmail.com> | 2020-11-23 14:42:35 +0530 |
| commit | 2fde590521fd88bde9e9df1c960e38df438bd040 (patch) | |
| tree | 9ffc964fe4f8a949d88da85e92df3c03fc78e2ac /benchmarks | |
| parent | 1f104fd565cce988cddb6120564b157f3f9ef240 (diff) | |
| download | numpy-2fde590521fd88bde9e9df1c960e38df438bd040.tar.gz | |
BENCH: Added floor divide benchmarks (#17727)
Diffstat (limited to 'benchmarks')
| -rw-r--r-- | benchmarks/benchmarks/bench_ufunc.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/benchmarks/benchmarks/bench_ufunc.py b/benchmarks/benchmarks/bench_ufunc.py index c388da5b5..ef3ebe75f 100644 --- a/benchmarks/benchmarks/bench_ufunc.py +++ b/benchmarks/benchmarks/bench_ufunc.py @@ -134,15 +134,20 @@ class CustomScalar(Benchmark): (self.d < 1) -class CustomScalarInt(Benchmark): - params = [10**size for size in range(1, 8)] - param_names = ['size'] - - def setup(self, size): - self.x = np.arange(size) - - def time_floor_divide(self, size): - self.x//8 +class CustomScalarFloorDivideInt(Benchmark): + params = ([np.int8, np.int16, np.int32, np.int64], [8, -8, 43, -43]) + param_names = ['dtype', 'divisors'] + max_value = 10**7 + min_value = -10**7 + + def setup(self, dtype, divisor): + iinfo = np.iinfo(dtype) + self.x = np.arange( + max(iinfo.min, self.min_value), + min(iinfo.max, self.max_value)) + + def time_floor_divide_int(self, dtpye, divisor): + self.x // divisor class Scalar(Benchmark): |
