Skip to content

PERF: Fix quantile perf regression #35101

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

Merged
merged 2 commits into from
Jul 3, 2020

Conversation

TomAugspurger
Copy link
Contributor

Closes #35049

591 µs ± 29.5 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

440 µs ± 22.8 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

Closes pandas-dev#35049

```pyhon
591 µs ± 29.5 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

440 µs ± 22.8 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
```
@TomAugspurger TomAugspurger added this to the 1.1 milestone Jul 2, 2020
)
# Don't change this to an f-string. The string formatting
# is too expensive for cases where we don't need it.
msg = "percentiles should all be in the interval [0, 1]." "Try {} instead."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra quotation marks probably an artifact of black

@jbrockmendel
Copy link
Member

Should we take a more general look at where we can/should do string formatting more lazily?

@WillAyd
Copy link
Member

WillAyd commented Jul 2, 2020

Interesting - so the evaluation of q / 100 makes things slower right? I would have thought generally f-strings would be more performant given things like this:

https://stackoverflow.com/questions/43123408/f-strings-in-python-3-6

But I suppose that assumes that the expression needs to be evaluated, which isn't the case here unless an exception occurs

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm when green

@simonjayhawkins simonjayhawkins added Performance Memory or execution speed performance Regression Functionality that used to work in a prior pandas version labels Jul 3, 2020
@simonjayhawkins simonjayhawkins merged commit 7e25af8 into pandas-dev:master Jul 3, 2020
@simonjayhawkins
Copy link
Member

Thanks @TomAugspurger

jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Jul 7, 2020
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 this pull request may close these issues.

Performance regression in frame_methods.Quantile.time_frame_quantile
4 participants