-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: speed up PeriodArray creation by exposing dayfirst/yearfirst params #24118
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
Conversation
Hello @qwhelan! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on December 29, 2018 at 09:59 Hours UTC |
I am personally -1 on adding this to the Period constructor. I also find it strange that a |
Yeah, we're spending 90%+ of runtime importing/querying these display variables. Unfortunately, this same code path is used for handling The caveat on the above is that this speedup is only when creating a Regarding the name of the option, it seems the intent was for it to cover display + parsing, but only parsing was ever implemented (per #11501 (comment) ) |
@qwhelan ok adding the benchmarks, but yea let's not mess with the Period constructor. where does the get_option things get called now that is slowings things down? |
@jreback Given the desire to keep the signature the same, I dug into breaking the import cycle and think I found a sensible way to break it - this yields a 7x improvement (down from 15x). The short description of the cycle is that importing |
@qwhelan look at how the import is deferred in
then you can use it like
|
3228823
to
c779265
Compare
Codecov Report
@@ Coverage Diff @@
## master #24118 +/- ##
==========================================
+ Coverage 92.32% 92.32% +<.01%
==========================================
Files 166 166
Lines 52298 52298
==========================================
+ Hits 48285 48286 +1
+ Misses 4013 4012 -1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #24118 +/- ##
==========================================
- Coverage 92.31% 92.2% -0.11%
==========================================
Files 163 162 -1
Lines 51987 51703 -284
==========================================
- Hits 47990 47674 -316
- Misses 3997 4029 +32
Continue to review full report at Codecov.
|
@jreback Eliminated the constructor changes and replaced with your suggestion. Also added a new benchmark as the int case before was hitting a special case. Here's the new benchmark comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this close the original issue? if so can you add a whatsnew note (or just add onto a prior one which I think is there)
1b3997f
to
c5089cd
Compare
@jreback Updated with whatsnew and comment. There's no specific issue open for this - I believe I stumbled across it while reviewing asv results. |
2a49371
to
c94f780
Compare
c94f780
to
bd9eddb
Compare
thanks @qwhelan nice! |
As much of the time creating a
PeriodArray
fromint
s is actually spent importing/queryingget_option('display.date_dayfirst')
and itsyearfirst
cousin, this PR exposes those parameters inPeriod.__new__()
to allow them to be queried once per array creation.This yields a ~15x speedup:
git diff upstream/master -u -- "*.py" | flake8 --diff