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

bpo-31581: Reduce the number of imports for functools #3757

Merged
merged 7 commits into from Sep 30, 2017

Conversation

Projects
None yet
6 participants
@methane
Member

methane commented Sep 26, 2017

Since functools and collections are very commonly used, it's worth enough to optimize import.

https://bugs.python.org/issue31581

@methane

This comment has been minimized.

Show comment
Hide comment
@methane

methane Sep 26, 2017

Member

I added 'skip news' tag, since #1269 don't have news too.

Member

methane commented Sep 26, 2017

I added 'skip news' tag, since #1269 don't have news too.

@ncoghlan

The functools.singledispatch change seems reasonable to me, since the cost of checking the import cache twice will be cheap compared to the overhead of defining a new function to apply @singledispatch to.

As per the comments on the argparse PR, this should be accompanied by a comment explaining the trade-off (i.e. there are many programs that use functools without singledispatch, so we trade-off making singledispatch marginally slower for the benefit of making start-up of such applications slightly faster)

However, I'm less sure of the appropriateness of the start-up vs runtime cost trade-off for Counter.most_common, so I'd prefer to see that change in a separate PR.

@bedevere-bot

This comment has been minimized.

Show comment
Hide comment
@bedevere-bot

bedevere-bot Sep 26, 2017

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I didn't expect the Spanish Inquisition!. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

bedevere-bot commented Sep 26, 2017

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I didn't expect the Spanish Inquisition!. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Show outdated Hide outdated Lib/functools.py Outdated
Show outdated Hide outdated Lib/test/test_functools.py Outdated
@methane

This comment has been minimized.

Show comment
Hide comment
@methane

methane Sep 28, 2017

Member

However, I'm less sure of the appropriateness of the start-up vs runtime cost trade-off for Counter.most_common, so I'd prefer to see that change in a separate PR.

fixed.

Member

methane commented Sep 28, 2017

However, I'm less sure of the appropriateness of the start-up vs runtime cost trade-off for Counter.most_common, so I'd prefer to see that change in a separate PR.

fixed.

@methane methane merged commit 9811e80 into python:master Sep 30, 2017

4 checks passed

bedevere/issue-number Issue number 31581 found
Details
bedevere/news "skip news" label found
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@methane methane deleted the methane:bpo31518-functools-import branch Sep 30, 2017

daxlab added a commit to daxlab/cpython that referenced this pull request Oct 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment