-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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-38045: Improve the performance of _decompose() in the enum.py #16483
Merged
ethanfurman
merged 2 commits into
python:master
from
hongweipeng:improve_enum_decompose3
Nov 26, 2019
Merged
bpo-38045: Improve the performance of _decompose() in the enum.py #16483
ethanfurman
merged 2 commits into
python:master
from
hongweipeng:improve_enum_decompose3
Nov 26, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@hongweipeng Can you show me the benchmark result? |
Use the initial example:
Before patch:
After patch:
|
For core-developers, I left the benchmark for the core-developers Baseline ./python.exe -m pyperf timeit -s 'from enum import Flag' 'F = Flag("F", list("abcdefghijklm"))' 'for idx in range(100):' ' F(idx)'
.....................
Mean +- std dev: 24.5 ms +- 0.3 ms PR
|
brandtbucher
reviewed
Oct 1, 2019
Misc/NEWS.d/next/Library/2019-09-30-12-09-41.bpo-38045.VDRtd3.rst
Outdated
Show resolved
Hide resolved
Co-Authored-By: Brandt Bucher <[email protected]>
ethanfurman
approved these changes
Nov 26, 2019
GitHub seem stuck on bedevere/news -- closing and reopening... |
jacobneiltaylor
pushed a commit
to jacobneiltaylor/cpython
that referenced
this pull request
Dec 5, 2019
…GH-16483) * Improve the performance of _decompose() in enum.py Co-Authored-By: Brandt Bucher <[email protected]>
shihai1991
pushed a commit
to shihai1991/cpython
that referenced
this pull request
Jan 31, 2020
…GH-16483) * Improve the performance of _decompose() in enum.py Co-Authored-By: Brandt Bucher <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The original code will access each element of
_value2member_map_
and check if the value is the power of 2.After optimization, access the elements in
_value2member_map_
as needed. In the initial example:the speedup is more than 100x .(The same for replacing Flag with IntFlag).
https://bugs.python.org/issue38045