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: consolidate imports inside parse_time_string #24084

Merged
merged 1 commit into from Dec 5, 2018

Conversation

Projects
None yet
3 participants
@qwhelan
Copy link
Contributor

commented Dec 4, 2018

This PR adds an asv benchmark for the creation of Period objects directly from integers, and an associated speedup for the same case.

When calling Period._from_ordinal(), the runtime is unfortunately dominated by a pair of import statements needed to pull in the global config settings display.date_dayfirst and display.date_yearfirst. Thus, simply consolidating them leads to a significant speedup:

Benchmarks that have improved:

       before           after         ratio
     [08395af4]       [696b40f1]
     <parse_time_string~1>       <parse_time_string>
-         176±3ms         98.7±3ms     0.56  period.PeriodIndexConstructor.time_from_ints('D')
  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry
@pep8speaks

This comment has been minimized.

Copy link

commented Dec 4, 2018

Hello @qwhelan! Thanks for submitting the PR.

@codecov

This comment has been minimized.

Copy link

commented Dec 4, 2018

Codecov Report

Merging #24084 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #24084   +/-   ##
=======================================
  Coverage   42.51%   42.51%           
=======================================
  Files         161      161           
  Lines       51689    51689           
=======================================
  Hits        21974    21974           
  Misses      29715    29715
Flag Coverage Δ
#single 42.51% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3fe697f...0f215ad. Read the comment docs.

@codecov

This comment has been minimized.

Copy link

commented Dec 4, 2018

Codecov Report

Merging #24084 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #24084   +/-   ##
=======================================
  Coverage   92.21%   92.21%           
=======================================
  Files         161      161           
  Lines       51684    51684           
=======================================
  Hits        47658    47658           
  Misses       4026     4026
Flag Coverage Δ
#multiple 90.61% <ø> (ø) ⬆️
#single 43% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b5f4d1...3e9370d. Read the comment docs.

@jreback jreback added the Performance label Dec 4, 2018

@jreback

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2018

can you rebase on master; I think there might be an error in the benchmark (or if not the script should complete green, the CI has been fixed).

@qwhelan qwhelan force-pushed the qwhelan:parse_time_string branch from 0f215ad to 4d9040f Dec 4, 2018

@jreback

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2018

can you remove the warnings from asv/benchmarks/frame_methods and re-push. thanks.

@jreback jreback added this to the 0.24.0 milestone Dec 4, 2018

@qwhelan qwhelan force-pushed the qwhelan:parse_time_string branch from 4d9040f to 0868c38 Dec 4, 2018

@qwhelan qwhelan force-pushed the qwhelan:parse_time_string branch from 0868c38 to 3e9370d Dec 5, 2018

@qwhelan

This comment has been minimized.

Copy link
Contributor Author

commented Dec 5, 2018

@jreback I believe the warnings in frame_methods were handled in another PR, so I've rebased again off master.

@jreback jreback merged commit 473f21a into pandas-dev:master Dec 5, 2018

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
pandas-dev.pandas Build #20181205.3 succeeded
Details
@jreback

This comment has been minimized.

Copy link
Contributor

commented Dec 5, 2018

thanks @qwhelan

Pingviinituutti added a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019

Pingviinituutti added a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.