Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Micro-optimize type indirection visitor#19460
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
Specialize iteration for the concrete types `list` and `tuple`,since this is faster than iterating over an abstract iterablein compiled code.Duplicate some very hot code in the hopes further improvingpreformance slightly, through inlining and possibly also betterbranch prediction.This is a part of a set of micro-optimizations that improve self checkperformance by ~5.5%.
According tomypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
ilevkivskyi left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Interesting, I would never guess this is a hot code path.
23e6072 intomasterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Specialize iteration for the concrete types
listandtuple, since this is faster than iterating over an abstract iterable in compiled code. Also avoid constructing many temporary lists.Duplicate some very hot code in the hopes further improving performance slightly, through inlining and possibly also better branch prediction.
The approach is similar to what I used in#19459.
This is a part of a set of micro-optimizations that improve self check performance by ~5.5%.