Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-44900: Add five superinstructions. #27741

Merged
merged 2 commits into from
Aug 16, 2021

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Aug 12, 2021

Adds 5 super instructions:

  • LOAD_FAST LOAD_FAST
  • STORE_FAST LOAD_FAST
  • LOAD_FAST LOAD_CONST
  • LOAD_CONST LOAD_FAST
  • STORE_FAST STORE_FAST

and produces a 2% speedup

https://bugs.python.org/issue44900

@sweeneyde
Copy link
Member

Is it worth micro-optimizing to use STACK_SHRINK(2)/STACK_GROW(2)/TOP()/SECOND()/SET_TOP()/SET_SECOND() rather than PUSH/POP? The error cases would have to then do the appropriate stack adjustment, but STORE_FAST__LOAD_FAST wouldn't have to do any stack adjustment at all in the non-error case.

@markshannon
Copy link
Member Author

It might well be. I'll try it out.

@markshannon
Copy link
Member Author

markshannon commented Aug 13, 2021

Comparing the commit using STACK_GROW etc to the original version shows that it actual slows things down by a small amount ( < 1%).
28 slower, 11 faster, 19 no change.

@markshannon markshannon merged commit 4f51fa9 into python:main Aug 16, 2021
@markshannon markshannon deleted the super-instructions branch August 23, 2021 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants