summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorRohit Goswami <rog32@hi.is>2023-03-04 16:02:03 +0000
committerRohit Goswami <rog32@hi.is>2023-03-04 16:02:03 +0000
commit56d2fd5d8735e73f41ab30f42d139309df7fd758 (patch)
tree6d9c22ef969b4c1450c53a951330f378a8751c1d /benchmarks
parent80245ea40b04a86cc9a99b4488de64f5fea0937e (diff)
downloadnumpy-56d2fd5d8735e73f41ab30f42d139309df7fd758.tar.gz
BENCH: Reduce shapes and types for speed
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/benchmarks/bench_core.py11
-rw-r--r--benchmarks/benchmarks/bench_linalg.py7
-rw-r--r--benchmarks/benchmarks/bench_manipulate.py5
-rw-r--r--benchmarks/benchmarks/bench_reduce.py13
-rw-r--r--benchmarks/benchmarks/bench_ufunc.py9
5 files changed, 23 insertions, 22 deletions
diff --git a/benchmarks/benchmarks/bench_core.py b/benchmarks/benchmarks/bench_core.py
index d6b6651e7..fe1cd37b6 100644
--- a/benchmarks/benchmarks/bench_core.py
+++ b/benchmarks/benchmarks/bench_core.py
@@ -217,11 +217,12 @@ class Indices(Benchmark):
class StatsMethods(Benchmark):
- params = [['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32',
- 'int64', 'uint64', 'float32', 'float64', 'intp',
- 'complex64', 'complex128', 'complex256',
- 'bool', 'float', 'int', 'complex'],
- [1000**n for n in range(0, 2)]]
+ # Not testing, but in array_api (redundant)
+ # 8, 16, 32 bit variants, and 128 complexes
+ params = [['int64', 'uint64', 'float64', 'intp',
+ 'complex64', 'bool', 'float', 'int',
+ 'complex', 'complex256'],
+ [100**n for n in range(0, 2)]]
param_names = ['dtype', 'size']
def setup(self, dtype, size):
diff --git a/benchmarks/benchmarks/bench_linalg.py b/benchmarks/benchmarks/bench_linalg.py
index 62f852567..b4e39b084 100644
--- a/benchmarks/benchmarks/bench_linalg.py
+++ b/benchmarks/benchmarks/bench_linalg.py
@@ -193,10 +193,11 @@ class Einsum(Benchmark):
class LinAlgTransposeVdot(Benchmark):
+ # Smaller for speed
+ # , (128, 128), (256, 256), (512, 512),
+ # (1024, 1024)
params = [[(16, 16), (32, 32),
- (64, 64), (128, 128),
- (256, 256), (512, 512),
- (1024, 1024)], TYPES1]
+ (64, 64)], TYPES1]
param_names = ['shape', 'npdtypes']
def setup(self, shape, npdtypes):
diff --git a/benchmarks/benchmarks/bench_manipulate.py b/benchmarks/benchmarks/bench_manipulate.py
index 4e630363e..0a312479c 100644
--- a/benchmarks/benchmarks/bench_manipulate.py
+++ b/benchmarks/benchmarks/bench_manipulate.py
@@ -39,9 +39,8 @@ class BroadcastArraysTo(Benchmark):
class ConcatenateStackArrays(Benchmark):
- params = [[(16, 32), (32, 64),
- (64, 128), (128, 256),
- (256, 512)],
+ # (64, 128), (128, 256), (256, 512)
+ params = [[(16, 32), (32, 64)],
[2, 3, 4, 5],
TYPES1]
param_names = ['shape', 'narrays', 'ndtype']
diff --git a/benchmarks/benchmarks/bench_reduce.py b/benchmarks/benchmarks/bench_reduce.py
index 3b1073fa3..040b5ca73 100644
--- a/benchmarks/benchmarks/bench_reduce.py
+++ b/benchmarks/benchmarks/bench_reduce.py
@@ -46,17 +46,18 @@ class AnyAll(Benchmark):
class StatsReductions(Benchmark):
- params = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32',
- 'int64', 'uint64', 'float32', 'float64', 'intp',
- 'complex64', 'complex128', 'complex256',
- 'bool', 'float', 'int', 'complex']
+ # Not testing, but in array_api (redundant)
+ # 8, 16, 32 bit variants, and 128 complexes
+ params = ['int64', 'uint64', 'float64', 'intp',
+ 'complex64', 'bool', 'float', 'int',
+ 'complex', 'complex256'],
param_names = ['dtype']
def setup(self, dtype):
try:
- self.data = np.ones(20000, dtype=getattr(np, dtype))
+ self.data = np.ones(200, dtype=getattr(np, dtype))
except AttributeError: # builtins throw AttributeError after 1.20
- self.data = np.ones(20000, dtype=dtype)
+ self.data = np.ones(200, dtype=dtype)
if dtype.startswith('complex'):
self.data = self.data * self.data.T*1j
diff --git a/benchmarks/benchmarks/bench_ufunc.py b/benchmarks/benchmarks/bench_ufunc.py
index 724a18ddc..8017bd491 100644
--- a/benchmarks/benchmarks/bench_ufunc.py
+++ b/benchmarks/benchmarks/bench_ufunc.py
@@ -163,7 +163,7 @@ class NDArrayGetItem(Benchmark):
def setup(self, margs, msize):
self.xs = np.random.uniform(-1, 1, 6).reshape(2, 3)
- self.xl = np.random.uniform(-1, 1, 100*100).reshape(100, 100)
+ self.xl = np.random.uniform(-1, 1, 50*50).reshape(50, 50)
def time_methods_getitem(self, margs, msize):
if msize == 'small':
@@ -232,11 +232,10 @@ class NDArrayAsType(Benchmark):
class UfuncsCreate(Benchmark):
""" Benchmark for creation functions
"""
+ # (64, 64), (128, 128), (256, 256)
+ # , (512, 512), (1024, 1024)
params = [[16, 32, 128, 256, 512,
- (16, 16), (32, 32),
- (64, 64), (128, 128),
- (256, 256), (512, 512),
- (1024, 1024)],
+ (16, 16), (32, 32)],
['C', 'F'],
TYPES1]
param_names = ['shape', 'order', 'npdtypes']