Cache a protocol member's parsed requirement; Fix #363 - #365
Merged
Merged
Conversation
enumeratio
force-pushed
the
protocol-requirement-cache
branch
from
September 29, 2026 04:34
87a9964 to
85558a2
Compare
… receiver type, keyed on the engine's any version and bounded per protocol, so a dispatched call no longer re-parses its Self-bearing signature; add regression tests. Fix cortex-js#363
enumeratio
force-pushed
the
protocol-requirement-cache
branch
from
September 29, 2026 21:19
85558a2 to
fef0b12
Compare
Contributor
Author
|
Pushed a review pass:
Member calls on the benchmark from #363 stay about 11× faster than on main. The PR also merges cleanly with #366 (CHANGELOG aside), and the combined result is just as fast. |
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.
Fix #363
requirementShapeandrequirementAtre-parsed the member's signature on every dispatched call. A signature namingSelfnever entersparseType's shared cache, and its resolver-less first attempt throws before the resolver-aware parse runs. The parsed requirement is now kept per protocol record (aWeakMap), keyed by member and the receiver'sSelfspelling, and the entry is dropped whence._cacheGeneration()moves, so a redeclared type re-parses. A read-only engine view without a generation parses as before.Measured on 3,000 scalar-receiver calls: 421 ms → 41 ms, against 32 ms for an equivalent plain function.