[PERF] Reuse cursor slots in NewTreeBuilder - #21609
Conversation
Split out of nvp/simplify-some-vm-hot-paths. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Re-test after moving to draft. Control rebuilt from scratch off Benchmark: Ran via
|
|
Across three runs the consistent rows are clearManyItems1 +4 to 7% and clearItems4 +3 to 5%, slower every time. render1000Items3 was +11 to 12% slower in two of three runs, and total duration reached significance only in this run (+2%). Nothing is consistently faster. That still points at the clear path, so the retained cursor slots holding stale |
NewTreeBuilderkeeps its cursors in an array indexed bycursorDepthand reusesCursorImplslots onpushElement, since opening an element is one of the most frequent VM operations. The modifier and block stacks become plain arrays too, andRehydrateTreepushes its richer cursors through a newpushCursor.🤖 Generated with Claude Code