-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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-46841: Quicken code in-place #31888
Conversation
1% perf improvement too:
|
This is still marked as draft, what is left to do? |
There is still an awkward spot in I’m still trying to understand the code better and figure out a cleaner way of doing this. Any ideas? |
#31968 should help. |
I think it is OK to sort out the peculiarities of |
🤖 New build scheduled with the buildbot fleet by @brandtbucher for commit c8054b9 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Buildbot failures are all pre-existing failures and unrelated to this PR. |
This moves the bytecode to the end of the corresponding
PyCodeObject
, and quickens it in-place.Related changes:
PyCodeObject
is now more compact. I've removed the almost-always-unusedco_varnames
,co_freevars
, andco_cellvars
member caches, and rearranged someint
members to fill some holes in the struct on 64-bit builds.co_code
has been removed and replaced with_PyCode_GetCode
, andco_quickened
andco_firstinstr
have been replaced with_PyCode_CODE
._PyOpcode_Deopt
is a new mapping from all opcodes to their un-quickened forms._PyOpcode_InlineCacheEntries
is renamed to_PyOpcode_Caches
,_Py_IncrementCountAndMaybeQuicken
is renamed to_PyCode_Warmup
,_Py_Quicken
is renamed to_PyCode_Quicken
, and_co_quickened
is renamed to_co_code_adaptive
(and is now a read-onlymemoryview
).https://bugs.python.org/issue46841