Skip to content

Commit 3aa2cbf

Browse files
committed
adding tests with almost full tables
1 parent 6a7cb72 commit 3aa2cbf

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

asv_bench/benchmarks/hash_functions.py

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,61 @@
33
import pandas as pd
44

55

6+
class IsinAlmostFullWithRandomInt:
7+
params = [
8+
[np.float64, np.int64, np.uint64, np.object],
9+
range(10, 21),
10+
]
11+
param_names = ["dtype", "exponent"]
12+
13+
def setup(self, dtype, exponent):
14+
M = 3 * 2 ** (exponent - 2)
15+
# 0.77-the maximal share of occupied buckets
16+
np.random.seed(42)
17+
self.s = pd.Series(np.random.randint(0, M, M)).astype(dtype)
18+
self.values = np.random.randint(0, M, M).astype(dtype)
19+
self.values_outside = self.values + M
20+
21+
def time_isin(self, dtype, exponent):
22+
self.s.isin(self.values)
23+
24+
def time_isin_outside(self, dtype, exponent):
25+
self.s.isin(self.values_outside)
26+
27+
28+
class IsinWithRandomFloat:
29+
params = [
30+
[np.float64, np.object],
31+
[
32+
1_300,
33+
2_000,
34+
7_000,
35+
8_000,
36+
70_000,
37+
80_000,
38+
750_000,
39+
900_000,
40+
],
41+
]
42+
param_names = ["dtype", "M"]
43+
44+
def setup(self, dtype, M):
45+
np.random.seed(42)
46+
self.values = np.random.rand(M)
47+
self.s = pd.Series(self.values).astype(dtype)
48+
np.random.shuffle(self.values)
49+
self.values_outside = self.values + 0.1
50+
51+
def time_isin(self, dtype, M):
52+
self.s.isin(self.values)
53+
54+
def time_isin_outside(self, dtype, M):
55+
self.s.isin(self.values_outside)
56+
57+
658
class IsinWithArangeSorted:
759
params = [
8-
[np.float64, np.int64, np.object],
60+
[np.float64, np.int64, np.uint64, np.object],
961
[
1062
1_000,
1163
2_000,
@@ -26,7 +78,7 @@ def time_isin(self, dtype, M):
2678

2779
class IsinWithArange:
2880
params = [
29-
[np.float64, np.int64, np.object],
81+
[np.float64, np.int64, np.uint64, np.object],
3082
[
3183
1_000,
3284
2_000,

0 commit comments

Comments
 (0)