-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
Extend and improve LOAD_COMMON_CONSTANT #148871
Copy link
Copy link
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement
Fields
Give feedbackNo fields configured for issues without a type.
Currently
LOAD_COMMON_CONSTANTonly loads 7 not-so-common constants and does so fairly inefficiently.It could be improved in two ways:
None, but also"",True,Falseand-1Make the constants that it does load both statically allocated and immortal to avoid the pointer chasing and incref operation. Onlyanyandallwould need changing.After some consideration, I think it best to leave the common constants table per interpreter, and not statically allocate them.
anyandallmay be breaking.AssertionErrorandNotImplementedErrorwill be tricky to make staticThey should all be immortal though, and stored as
_PyStackRefs notPyObject *s.Linked PRs
LOAD_COMMON_CONSTANT#148971LOAD_COMMON_CONSTANTuse immortal stackref borrows #149625