Skip to content

Commit 1138f18

Browse files
authored
BENCH: Fix CategoricalIndexing benchmark (#38476)
1 parent 5ad4e57 commit 1138f18

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

.github/workflows/ci.yml

+4-8
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,10 @@ jobs:
7474
asv check -E existing
7575
git remote add upstream https://github.com/pandas-dev/pandas.git
7676
git fetch upstream
77-
if git diff upstream/master --name-only | grep -q "^asv_bench/"; then
78-
asv machine --yes
79-
asv dev | sed "/failed$/ s/^/##[error]/" | tee benchmarks.log
80-
if grep "failed" benchmarks.log > /dev/null ; then
81-
exit 1
82-
fi
83-
else
84-
echo "Benchmarks did not run, no changes detected"
77+
asv machine --yes
78+
asv dev | sed "/failed$/ s/^/##[error]/" | tee benchmarks.log
79+
if grep "failed" benchmarks.log > /dev/null ; then
80+
exit 1
8581
fi
8682
if: always()
8783

asv_bench/benchmarks/indexing.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
lower-level methods directly on Index and subclasses, see index_object.py,
44
indexing_engine.py, and index_cached.py
55
"""
6+
import string
67
import warnings
78

89
import numpy as np
@@ -255,6 +256,7 @@ def setup(self, index):
255256
"non_monotonic": CategoricalIndex(list("abc" * N)),
256257
}
257258
self.data = indices[index]
259+
self.data_unique = CategoricalIndex(list(string.printable))
258260

259261
self.int_scalar = 10000
260262
self.int_list = list(range(10000))
@@ -281,7 +283,7 @@ def time_get_loc_scalar(self, index):
281283
self.data.get_loc(self.cat_scalar)
282284

283285
def time_get_indexer_list(self, index):
284-
self.data.get_indexer(self.cat_list)
286+
self.data_unique.get_indexer(self.cat_list)
285287

286288

287289
class MethodLookup:

0 commit comments

Comments
 (0)