Uh oh!
There was an error while loading. Please reload this page.
gh-141510: Update specializer to support frozendict with BINARY_SUBSCR - #144911
gh-141510: Update specializer to support frozendict with BINARY_SUBSCR#144911corona10 wants to merge 13 commits into
Conversation
Sacul0457
commented
Feb 17, 2026
Would it be good if |
Fidget-Spinner
commented
Feb 17, 2026
I think it's better to focus on getting the specializer correct in this PR for now. We can leave the JIT for another PR. |
corona10
commented
Feb 17, 2026
@Sacul0457 I think that we have to, I will update the PR or handle it at the seperate PR, but it needs feedback from JIT team first :) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Fidget-Spinner
commented
Feb 17, 2026
This needs tests in |
corona10
commented
Feb 17, 2026
Once the PR is merged, I am also going to work on |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Victor Stinner <vstinner@python.org>
@Fidget-Spinner Now whole unit tests are passed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Do you have any evidence that this will improve performance? Opcodes are a limited resource, and since no one is using frozen dicts yet, this is just going to slow down the interpreter by adding bulk. Relaxing the guard in |
corona10
commented
Feb 18, 2026
I like that option too. |
We need to register frozendict for support in the specializer.
Since frozendict is only introduced in Python 3.15, it is not yet widely used. However, it is thread safe for many operations, including
CALL_LENandBINARY_OP_SUBSCR. It could also be optimized more aggressively in the JIT usingKNOWN_CLASSoptimizations in the pipeline.This is just part of a draft PR. I am also happy to make
_BINARY_OP_SUBSCR_FROZEN_DICTpart of_BINARY_OP_SUBSCR_DICT, depending on what the JIT team prefers.Without this PR, frozendict would be at a performance disadvantage, even though it is intended to be a first-class citizen alongside dict.