| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Would it be good if _GUARD_NOS_FROZEN_DICT was added to optimizer_bytecodes.c so that it could be removed by the optimizer if the type is known? |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
@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 :) |
Sorry, something went wrong.
|
This needs tests in test_opcache for the specialization success and failure case. |
Sorry, something went wrong.
|
Once the PR is merged, I am also going to work on CONTAINS_OP_FROZENDICT too. |
Sorry, something went wrong.
Co-authored-by: Victor Stinner <vstinner@python.org>
|
@Fidget-Spinner Now whole unit tests are passed. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
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 BINARY_OP_SUBSCR_DICT to check for any dict, and removing the redundant check in PyDict_GetItemRef would achieve your goal without lots of extra code or any slow down. |
Sorry, something went wrong.
I like that option too. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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_LEN and BINARY_OP_SUBSCR. It could also be optimized more aggressively in the JIT using KNOWN_CLASS optimizations in the pipeline.
This is just part of a draft PR. I am also happy to make _BINARY_OP_SUBSCR_FROZEN_DICT part 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.