8000 Merge pull request #8834 from juliantaylor/count_nonzero-bench · juliantaylor/numpy@9791f20 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9791f20

Browse files
authored
Merge pull request numpy#8834 from juliantaylor/count_nonzero-bench
BENCH: use initialized memory for count_nonzero benchmark
2 parents ab49be1 + 533fba4 commit 9791f20

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

benchmarks/benchmarks/bench_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ class CountNonzero(Benchmark):
137137
]
138138

139139
def setup(self, numaxes, size, dtype):
140-
self.x = np.empty(shape=(
141-
numaxes, size), dtype=dtype)
140+
self.x = np.arange(numaxes * size).reshape(numaxes, size)
141+
self.x = (self.x % 3).astype(dtype)
142142

143143
def time_count_nonzero(self, numaxes, size, dtype):
144144
np.count_nonzero(self.x)

doc/source/dev/gitwash/development_workflow.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ what not to do; the reader has to go look for context elsewhere.
174174
Standard acronyms to start the commit message with are::
175175

176176
API: an (incompatible) API change
177+
BENCH: changes to the benchmark suite
177178
BLD: change related to building numpy
178179
BUG: bug fix
179180
DEP: deprecate something, or remove a deprecated object

0 commit comments

Comments
 (0)
0