gh-92777: Add LOAD_METHOD_LAZY_DICT#92778
Conversation
|
Hah, looks like I was wrong, it wasn't that straightforward after all :). |
…nner/cpython into load_method_lazy_dict
markshannon
left a comment
There was a problem hiding this comment.
A few minor issues, but generally looks good.
What are the stats for the LOAD_METHOD_LAZY_DICT instruction?
|
How do you collect stats for pyperformance and create that nice table on faster-cpython? I'm frankly clueless (I only know how to use the one that dumps stats out to the terminal or file). Sorry. On test suite code, I get a 0.3% improvement on hits and 0.6% more misses. But I want to point out that |
|
Wow looks like my expectations were proven wrong by the stats again, after removing The part of the stdlib I've found that frequently uses this instruction is the I'm not feeling too confident about this optimization now. It seems like something that would boost our pyperformance numbers but maybe not in the real world? |
|
Generating the table is somewhat manual and hacky. I mean to automate it, but for now here's the procedure:
The table is created by running |
|
I have the stats here https://gist.github.com/Fidget-Spinner/4dbc2d002c30e36587939c4bdfd9840c. LOAD_METHOD specialization hits are now 83.5%. It is 78.7% hits on the faster-cpython repo. So that's roughly a 5% increase. |
|
Stats look good. Code looks good. |
|
No real difference in performance, but in line with what we would expect. |
Fixes #92777. Specialize LOAD_METHOD for lazy dictionaries. This accounts for 40% of the misses.
I'm sad that I missed 3.11 beta freeze for this specialization. It's straightforward and is likely to account for the majority of LOAD_METHOD in real world code since lazy
__dict__is now commonplace.