10000 BENCH: Added benchmarks for fast paths (#17970) · numpy/numpy@3d1f4cd · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d1f4cd

Browse files
committed
BENCH: Added benchmarks for fast paths (#17970)
1 parent 933620b commit 3d1f4cd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

benchmarks/benchmarks/bench_ufunc.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,21 @@ def time_floor_divide_int(self, dtpye, divisor):
150150
self.x // divisor
151151

152152

153+
class CustomScalarEqual(Benchmark):
154+
params = (
155+
[np.int8, np.int16, np.int32, np.int64,
156+
np.uint8, np.uint16, np.uint32, np.uint64,
157+
np.float32, np.float64])
158+
param_names = ['dtype']
159+
160+
def setup(self, dtype):
161+
self.scalar_x = dtype(np.random.randint(-128, 127))
162+
self.scalar_y = np.random.randint(-128, 127)
163+
164+
def time_scalar_equality(self, dtype):
165+
for i in range(10**6):
166+
self.scalar_x == self.scalar_y
167+
153168
class Scalar(Benchmark):
154169
def setup(self):
155170
self.x = np.asarray(1.0)

0 commit comments

Comments
 (0)
0