Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
GH-89987: Shrink theBINARY_SUBSCR
caches#103022
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
markshannon commentedMar 28, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm a bit concerned about
Is this OK? I think it is, but it requires a different contract between the specializer, the specialized code and the class's cache, than we had before. This contract will need to be clearly documented.
|
Yes, that's correct. I'll document this clearly in a comment. |
Uh oh!
There was an error while loading.Please reload this page.
BINARY_SUBSCR
has 3 cache entries that are only used byBINARY_SUBSCR_GETITEM
(a type version and a function version). However, we don't really need to store all of this information per call-site... we can just keep the function version on the type (next to the cached method) and clear the cached method whenever the type is modified.Besides the savings in code size, this has a couple of other minor benefits:
BINARY_SUBSCR_GETITEM
site can work withany heap type defining__getitem__
, provided it's already been cached at least once somewhere.Performance isneutral.