-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The optimizer currently calls getenv
during every optimization attempt. This has a small, but statistically significant 0.5% impact on performance. Do we need to do this each time, or could we read it to a flag during initialization?
diff --git a/Python/optimizer.c b/Python/optimizer.c
index 88c45f2e73c..b55556d30ab 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -1010,8 +1010,7 @@ uop_optimize(
return err;
}
OPT_STAT_INC(traces_created);
- char *env_var = Py_GETENV("PYTHON_UOPS_OPTIMIZE");
- if (env_var == NULL || *env_var == '\0' || *env_var > '0') {
+ if (true) {
err = _Py_uop_analyze_and_optimize(frame, buffer,
UOP_MAX_TRACE_LENGTH,
curr_stackentries, &dependencies);
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error