gh-146381: Constant fold local frozendict subscript lookups via recording#146564
gh-146381: Constant fold local frozendict subscript lookups via recording#146564corona10 wants to merge 1 commit intopython:mainfrom
Conversation
| else { | ||
| PyObject *probable = sym_get_probable_value(nos); | ||
| if (probable != NULL && PyFrozenDict_CheckExact(probable)) { | ||
| ADD_OP(_GUARD_NOS_IS, 0, (uintptr_t)probable); | ||
| sym_set_const(nos, probable); | ||
| } | ||
| } |
There was a problem hiding this comment.
@Fidget-Spinner
With this change, we can just simply use the change from what we added from
#146490, it looks like a more natural way from JIT optimizer.
Fidget-Spinner
left a comment
There was a problem hiding this comment.
Thanks! I think this might not be an optimization we want. Wouldnt the frozendict identity change over function invocations?
fc38b65 to
170a3e0
Compare
Ah yes.. that's correct. |
|
I thought this would be helpful for loop-heavy workloads within a single function call. Would you prefer a different approach? (if we assume that deopt could be cheap for the new call) |
Yeah I think this will be useful for loops, but we want to make sure the loops are valid for the next function invocation, so I think we shouldn't do any identity stuff, unless we know the frozendict is always the same. |
Uh oh!
There was an error while loading. Please reload this page.