-
-
Notifications
You must be signed in to change notification settings - Fork 158
perf(runtime): one shape-descriptor lookup per dynamic write IC hit, not two #8975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+47
−6
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| The dynamic write IC does one shape-descriptor lookup per hit instead of two. | ||
|
|
||
| `object_shape_id` runs a full shape-table lookup — and copies the whole | ||
| `ShapeDescriptor` out of the table — purely to prove the stamped id is live, | ||
| then discards it. `dyn_ic_try_store` called it for the token compare and then | ||
| looked the SAME id up again for the slot bound; both write re-prime sites did | ||
| the same while already holding a descriptor. | ||
|
|
||
| It now reads the stamp off the header. In `dyn_ic_try_store` the token compare | ||
| runs first, so a wrong-shape receiver costs a load and a compare with no table | ||
| work at all, and the single lookup that supplies the slot bound doubles as the | ||
| liveness proof: a stamp with no live descriptor returns `None` exactly where | ||
| `object_shape_id`'s 0 made the token compare fail before. | ||
|
|
||
| Verified by profile rather than by wall clock, because the effect is close to | ||
| the noise floor of the benchmark. In a computed-key write loop | ||
| `shape_descriptor_by_id` falls **7.01% → 3.49%** of self time and | ||
| `object_shape_id` (1.32%) leaves the profile entirely. | ||
|
|
||
| Wall clock, interleaved A/B min-of-21 at quiet load, against the exact parent | ||
| commit: write-only loop 42 → 40 ms min (−4.8%), mean 46 → 45. The combined | ||
| overwrite loop and the read loop are unchanged, as expected for a change | ||
| confined to the write IC. Computed-key differential output is byte-identical | ||
| to node; suite 2779 passed, 0 failed. |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use one verified profile baseline.
This comment says
shape_descriptor_by_idwas 10.5% of self time. The PR summary andchangelog.d/8975-single-shape-lookup-per-ic-hit.mdreport 7.01% before the change and 3.49% after it for the same computed-key write loop. Change 10.5% or identify the separate benchmark that produced it.🤖 Prompt for AI Agents