Reduce repeated memo frame discovery cost - #35
Draft
acecchini wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repeated shape checks currently read the local-variable mapping of every frame while searching for the live beartype checking scope. Reject impossible candidates using code-variable names first, then retain the existing live-value checks for decorated functions and DOOR checkers. This preserves memo ownership and lifetime without adding a cache.
On published beartype rc0, matched strict parameter/return calls improved from 19.546 to 16.955 microseconds on Python 3.10 and from 18.262 to 13.358 on 3.14 (about 13% and 27%). These are host measurements from 14 samples of 20,000 calls, with scenario order reversed; there is no timing gate or portable latency promise. The change is independent of the proposed upstream protocol in PR #34.
Validation: 1,094 CPU runtime tests, all eight four-checker harness cases, real commit/pre-push hooks, and a focused regression proving unrelated-frame locals are never accessed. Its combination with PR #34 passed 1,125 tests from normally installed archive consumers on both Python endpoints, plus minimal import checks. Five existing CPU skip records remain; no new CUDA evidence is claimed. The ExecPlan records source and artifact identities and matched comparison details.