Don't quicken in-place. #338
Replies: 4 comments
-
|
It is important that quickening, if it happens at all, must occur on the first call. |
Beta Was this translation helpful? Give feedback.
-
|
I'm a bit worried that this will negatively impact startup time, due to needing to allocate and expand the bytecode and all debugging tables for every function's first call. It seems that the main issue here is memory bloat due to the debugging tables growing to accommodate more What's the estimated break-even point (% of code objects ever actually executed once) where this would result in memory savings over the current scheme? |
Beta Was this translation helpful? Give feedback.
-
We currently need to get the expanded bytecode during unmarshaling, so this shouldn't be worse; less data to fetch from disk, but an additional allocation and some copying.
Yes, #324 should cover it. But we need to implement that as well.
The break-even is about 65%, given that the bytecode with caches is about 3 times the compact form. |
Beta Was this translation helpful? Give feedback.
-
|
Can we collect stats about unused code objects? Not from benchmarks. Maybe Cinder knows this for the Instagram code? I imagine CLI apps might have lots of code that’s never run in any particular invocation. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Now that we are quickening in-place, I wonder if we shouldn't.
An alternative scheme would be to add back the
co_firstinstrpointer, and originalco_codebytes object.For functions,
co_firstinstrwould initially point to aQUICKENbytecode, to quicken without an additional test on each call.For classes and modules,
co_firstinstrwould point to the start of the code in theco_codebytes object.There are a number of advantages:
QUICKENdoes the work of expanding the bytecode.Although there are also some disadvantages:
BINARY_OP_UNSPECIALIZEDandBINARY_SUBSCR_UNSPECIALIZEDbytecodes for quickened code when we want an unspecialized form of those operations, as the base forms would not skip the following cache.Cost analysis:
QUICKENbytecode does the job for us.The
QUICKENbytecodeThis would expand out the compact form into the form with caches, doing quickening at the same time.
It would then update the
co_firstinstrand internal variables, and resume execution.Beta Was this translation helpful? Give feedback.
All reactions