Skip to content

Commit c91f374

Browse files
committed
Review (WillAyd) [ci skip]
1 parent 7f2f3b5 commit c91f374

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

asv_bench/benchmarks/strings.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,24 @@ def time_repeat(self, repeats):
8787
class Cat(object):
8888

8989
goal_time = 0.2
90-
params = ([None, 5], [None, ','], [None, '-'], [0.0, 1e-4, 0.1])
91-
param_names = ['others', 'sep', 'na_rep', 'na_frac']
90+
params = ([0, 3], [None, ','], [None, '-'], [0.0, 0.01, 0.15])
91+
param_names = ['other_cols', 'sep', 'na_rep', 'na_frac']
9292

93-
def setup(self, others, sep, na_rep, na_frac):
94-
N = int(5e5)
93+
def setup(self, other_cols, sep, na_rep, na_frac):
94+
N = 10 ** 5
9595
mask_gen = lambda: np.random.choice([True, False], N,
9696
p=[1 - na_frac, na_frac])
9797
self.s = Series(tm.makeStringIndex(N)).where(mask_gen())
9898
self.others = (DataFrame({i: tm.makeStringIndex(N).where(mask_gen())
99-
for i in range(others)})
100-
if others is not None else None)
99+
for i in range(other_cols)})
100+
if other_cols > 0 else None)
101101

102-
def time_cat(self, others, sep, na_rep, na_frac):
103-
# before the concatenation (one caller + others columns), the total
102+
def time_cat(self, other_cols, sep, na_rep, na_frac):
103+
# before the concatenation (one caller + other_cols columns), the total
104104
# expected fraction of rows containing any NaN is:
105-
# reduce(lambda t, _: t + (1 - t) * na_frac, range(others + 1), 0)
106-
# for others=5 and na_frac=0.1, this works out to ~47%
107-
self.s.str.cat(self.others, sep=sep, na_rep=na_rep)
105+
# reduce(lambda t, _: t + (1 - t) * na_frac, range(other_cols + 1), 0)
106+
# for other_cols=3 and na_frac=0.15, this works out to ~48%
107+
self.s.str.cat(others=self.others, sep=sep, na_rep=na_rep)
108108

109109

110110
class Contains(object):

0 commit comments

Comments
 (0)