| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
So if I'm understanding this correctly, for each class only 16 methods/attributes can be specialised, with everything after just failing? If so 16 seems fairly small, especially for larger libraries/applications. Something like ndarray or flask.Flask for instance has 50+ methods. I could imagine a larger application using different sets of methods in different areas, filling up the cache. That wouldn't be the sort of thing showing up on benchmarks. |
Sorry, something went wrong.
Correct (not including instance attributes). I definitely prefer a growable cache to this approach, except that the numbers we have are slower. I'm also open to using a larger number of entries, like 32 or 64, if others feel similarly. |
Sorry, something went wrong.
|
I'm also not sure if this causes problems for interpreter isolation. Maybe putting this sort of state on static built-in types is a bad idea, whether it's resizable or not. |
Sorry, something went wrong.
|
(Docs now passing now #103019 is merged, and updating this with main. Thanks for flagging!) |
Sorry, something went wrong.
|
From a correctness point of view, adding the cache to static classes should be fine. All the attributes of superclasses of static classes must also be static. However, we would like static classes to be const so that they can be properly shared, which would mean that the cache would need to be pre-populated with all attributes of the class and all its superclasses. |
Sorry, something went wrong.
|
Closing because of the various issues outlined above. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This adds a fixed array of cached methods to the PyTypeObject struct. This approach saves memory if there are ~23x more LOAD_ATTR sites than there are types.
A size of 16 was chosen because:
A flexible buffer was also considered, but that was 1% slower, likely due to the additional indirection and management of the buffer.