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

bpo-41006: collections imports lazily heap #20940

Merged
merged 1 commit into from
Jun 17, 2020
Merged

bpo-41006: collections imports lazily heap #20940

merged 1 commit into from
Jun 17, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 17, 2020

The collections module now import lazily the heapq modules in the
Counter.most_common() method to speedup Python startup time.

https://bugs.python.org/issue41006

The collections module now import lazily the heapq modules in the
Counter.most_common() method to speedup Python startup time.
@vstinner
Copy link
Member Author

This change has no significant impact on most_common() method performance:

$ python3 -m pyperf compare_to master.json lazy_heapq.json 
Benchmark hidden because not significant (1): timeit

I used the commands:

./python -m venv env
env/bin/python -m pip install pyperf
env/bin/python -m pyperf timeit -s 'import collections; counter=collections.Counter("abcdefabc")' 'counter.most_common()'

@vstinner
Copy link
Member Author

2 hours later, not Travis CI build was started :-( I cannot see my PR at https://travis-ci.org/github/python/cpython/pull_requests

I close/reopen the PR to force a new Travis CI job.

@vstinner vstinner closed this Jun 17, 2020
@vstinner vstinner reopened this Jun 17, 2020
@vstinner vstinner merged commit 7824cc0 into python:master Jun 17, 2020
@vstinner vstinner deleted the lazy_heapq branch June 17, 2020 17:10
arun-mani-j pushed a commit to arun-mani-j/cpython that referenced this pull request Jul 21, 2020
The collections module now imports lazily the heapq modules in the
Counter.most_common() method to speedup Python startup time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants