FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-104584: Allow optimizers to opt out of optimizing. by markshannon · Pull Request #105244 · python/cpython · GitHub

/ cpython Public

GH-104584: Allow optimizers to opt out of optimizing. - #105244

Merged
markshannon merged 1 commit into
python:mainfrom
faster-cpython:allow-optimizer-to-not-optimize
Jun 5, 2023
Merged

GH-104584: Allow optimizers to opt out of optimizing.#105244
markshannon merged 1 commit into
python:mainfrom
faster-cpython:allow-optimizer-to-not-optimize

Conversation

markshannon commented Jun 2, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Comment thread Python/optimizer.c
Comment on lines +164 to +165
_PyFrame_SetStackPointer(frame, stack_pointer);
return frame;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We could also complicate the signature of _PyOptimizer_BackEdge to signal this case back to the caller so we could avoid the stack pointer write, and the caller could just continue regular interpretation instead of needing to goto resume_frame and update interpreter state from the frame again. But probably not worth it I guess, if optimizers declining to optimize should be rare?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Most calls to _PyOptimizer_BackEdge will return the same frame. We could add a check for it in JUMP_BACKWARD, but I think we would still need to save the stack pointer.
Even if we could avoid it, I suspect a single unconditional write is faster than the additional logic to avoid it.

markshannon merged commit e8ecb9e into python:main Jun 5, 2023
markshannon deleted the allow-optimizer-to-not-optimize branch September 26, 2023 12:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL