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 intopython:mainfrom
Conversation
|
Would it be good if |
|
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. |
|
@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 :) |
|
This needs tests in |
|
Once the PR is merged, I am also going to work on |
Co-authored-by: Victor Stinner <vstinner@python.org>
|
@Fidget-Spinner Now whole unit tests are passed. |
Misc/NEWS.d/next/Core_and_Builtins/2026-02-17-21-46-55.gh-issue-141510.8SqYuG.rst
Outdated
Show resolved
Hide resolved
|
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 |
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.