Repository navigation
Conversation
Open
Member
Author
|
parking until #1756 is merged |
Janther
marked this pull request as draft
October 6, 2026 17:43
Janther
force-pushed
the
collect-first-builder-after
branch
from
October 13, 2026 15:58
5c9d4d9 to
f53558e
Compare
…truction even starts.
…collectMetadata()`
Janther
force-pushed
the
collect-first-builder-after
branch
from
October 19, 2026 16:02
f53558e to
0e4a7af
Compare
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.
Every call into Slang's
wasmthat returns an object has to build a new JavaScript object from scratch. Each node's constructor calledchildren()on its own Slang node, creating an array and a new object for every child. Instead, we now walk the tree once and collect all the metadata (locations and comments) before calling the constructors;SlangNode's constructor is now just a lookup.There is a 10% improvement in the parsing speed after these changes and the constructor for each node is much cleaner.
Important changes:
Instead of calling
node.children()at each constructor, we walk the whole tree once using aCursor.This way we avoid creating an array of new JavaScript objects for each parent node.
Instead of calling
node.textLengthon everyNonterminalNode, and since we are already recursively walking the tree, we just use the pointer avoiding another call to thewasm.