Skip to content

Commit 26c9597

Browse files
committed
PERF: add coverage for non-default directions in merge_asof
1 parent f12e0fe commit 26c9597

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

asv_bench/benchmarks/join_merge.py

+16-11
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,10 @@ def time_merge_ordered(self):
278278

279279

280280
class MergeAsof(object):
281+
params = [['backward', 'forward', 'nearest']]
282+
param_names = ['direction']
281283

282-
def setup(self):
284+
def setup(self, direction):
283285
one_count = 200000
284286
two_count = 1000000
285287

@@ -311,20 +313,23 @@ def setup(self):
311313
self.df1e = df1[['time', 'key', 'key2', 'value1']]
312314
self.df2e = df2[['time', 'key', 'key2', 'value2']]
313315

314-
def time_on_int(self):
315-
merge_asof(self.df1a, self.df2a, on='time')
316+
def time_on_int(self, direction):
317+
merge_asof(self.df1a, self.df2a, on='time', direction=direction)
316318

317-
def time_on_int32(self):
318-
merge_asof(self.df1d, self.df2d, on='time32')
319+
def time_on_int32(self, direction):
320+
merge_asof(self.df1d, self.df2d, on='time32', direction=direction)
319321

320-
def time_by_object(self):
321-
merge_asof(self.df1b, self.df2b, on='time', by='key')
322+
def time_by_object(self, direction):
323+
merge_asof(self.df1b, self.df2b, on='time', by='key',
324+
direction=direction)
322325

323-
def time_by_int(self):
324-
merge_asof(self.df1c, self.df2c, on='time', by='key2')
326+
def time_by_int(self, direction):
327+
merge_asof(self.df1c, self.df2c, on='time', by='key2',
328+
direction=direction)
325329

326-
def time_multiby(self):
327-
merge_asof(self.df1e, self.df2e, on='time', by=['key', 'key2'])
330+
def time_multiby(self, direction):
331+
merge_asof(self.df1e, self.df2e, on='time', by=['key', 'key2'],
332+
direction=direction)
328333

329334

330335
class Align(object):

0 commit comments

Comments
 (0)