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

gh-102869: Bytecode Superoptimizer #104056

Closed
wants to merge 4 commits into from
Closed

gh-102869: Bytecode Superoptimizer #104056

wants to merge 4 commits into from

Conversation

CCLDArjun
Copy link
Contributor

@CCLDArjun CCLDArjun commented May 1, 2023

Not ready to review

Trying to write a bytecode optimizer as described in #102869. It calculates the stack effect for instructions with no side effect, looks up the best instructions to achieve this and replaces them.

Takes this code:

LOAD_FAST 6
LOAD_FAST 5
SWAP 2

calculates the stack will be [ 6 5 ] and converts that to [ 0 1 ]. Then, looks up [ 0 1 ] in the table. It should get back something like:

LOAD 1
LOAD 0

then optimizes the original code down to

LOAD_FAST 5
LOAD_FAST 6
NOP

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@arhadthedev arhadthedev added performance Performance or resource usage interpreter-core (Objects, Python, Grammar, and Parser dirs) labels May 2, 2023
@CCLDArjun CCLDArjun closed this May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants