Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERF: regression in Series.asof with single date #38083

Closed
jorisvandenbossche opened this issue Nov 26, 2020 · 2 comments · Fixed by #38103
Closed

PERF: regression in Series.asof with single date #38083

jorisvandenbossche opened this issue Nov 26, 2020 · 2 comments · Fixed by #38103
Labels
Performance Memory or execution speed performance Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@jorisvandenbossche
Copy link
Member

From https://pandas.pydata.org/speed/pandas/#timeseries.AsOf.time_asof_single?p-constructor='Series'&commits=52a17259-24e881d4&x-axis=commit&Cython=0.29.21&python=3.8

Snippet extracted from ASV:

N = 10000
rng = pd.date_range(start="1/1/1990", periods=N, freq="53s")
s = pd.Series(np.random.randn(N), index=rng)

dates = pd.date_range(start="1/1/1990", periods=N * 10, freq="5s")
date = dates[0]

%timeit s.asof(date)

On pandas 1.1 this takes around 20µs, on master I get around 110µs

Commit range indicated by ASV is 52a1725...24e881d

@jorisvandenbossche jorisvandenbossche added Performance Memory or execution speed performance Regression Functionality that used to work in a prior pandas version labels Nov 26, 2020
@jorisvandenbossche jorisvandenbossche added this to the 1.2 milestone Nov 26, 2020
@jorisvandenbossche
Copy link
Member Author

Profile indicates a lot of use of searchsorted, so potential cause #37990 cc @jbrockmendel

@jbrockmendel
Copy link
Member

Yep, restoring the overriden searchsorted method fixes the perf. that suggests there's a lot of overhead in algorithms.searchsorted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Memory or execution speed performance Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants