Skip to content

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
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