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-116772: Cache getenv result in optimizer.c to reduce calls #126439

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Wulian233
Copy link
Contributor

@Wulian233 Wulian233 commented Nov 5, 2024

This is my first time PR for part C, which looks like it might be a small improvement, hopefully I'm not doing anything wrong🙂

About 0.5% faster? (from issue)

Comment on lines +1228 to +1229
static int uop_optimize_initialized = 0;
static int uop_optimize_flag = 0;
Copy link
Member

Choose a reason for hiding this comment

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

This isn't thread safe or subinterpreter safe. You might want to store the value in a PyThreadState / PyInterpreterState in pylifecycle.c instead.

@Wulian233 Wulian233 marked this pull request as draft November 5, 2024 12:44
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.

2 participants