Skip to content

Commit 300d0a7

Browse files
committed
only factor 10
1 parent bf2343e commit 300d0a7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_stats.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,10 @@ def test_stats_benchmark(
371371
axis: Literal[0, 1] | None,
372372
dtype: type[np.float32 | np.float64],
373373
) -> None:
374-
n = 100_000 if "sparse" in array_type.mod else 10_000
375-
arr = array_type.random((n, n), dtype=dtype)
374+
# test with 10M elements will take 20ms for the fastest functions
375+
n_elems, density = 10_000_000, 0.01
376+
n = int(np.sqrt(n_elems / density if "sparse" in array_type.mod else n_elems))
377+
arr = array_type.random((n, n), density=density, dtype=dtype)
376378

377379
func(arr, axis=axis) # warmup: numba compile
378380
benchmark(func, arr, axis=axis)

0 commit comments

Comments
 (0)