-
Couldn't load subscription status.
- Fork 638
(optimization): Using SyntaxNodeBuilder pattern for get_children #8529
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
base: eytan_graphite/make_get_children_an_iterator
Are you sure you want to change the base?
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
babde02 to
b6e377e
Compare
b6e377e to
983fa39
Compare
afa2a8e to
d60a80f
Compare
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.
@orizi reviewed all commit messages.
Reviewable status: 0 of 14 files reviewed, 2 unresolved discussions (waiting on @TomerStarkware)
crates/cairo-lang-syntax/src/node/mod.rs line 145 at r1 (raw file):
/// Eagerly builds syntax nodes for the remaining children. pub fn nodes(
Suggestion:
pub fn as_syntax_nodes(crates/cairo-lang-syntax/src/node/mod.rs line 193 at r1 (raw file):
/// Constructs a [SyntaxNode] for this child. pub fn build(&self, db: &'a dyn Database) -> SyntaxNode<'a> {
Suggestion:
pub fn as_syntax_node(&self, db: &'a dyn Database) -> SyntaxNode<'a> {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.
@TomerStarkware reviewed 14 of 14 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @eytan-starkware)

TL;DR
Optimize syntax node traversal by introducing a
SyntaxNodeBuilderthat delays node construction until needed.What changed?
This PR introduces a new
SyntaxNodeBuildertype that provides access to a child node's metadata without immediately constructing a fullSyntaxNode. The key changes include:ChildrenIterto returnSyntaxNodeBuilderinstead ofSyntaxNode.nodes(db)method to eagerly build syntax nodes when neededget_children(db)to either:.nodes(db)or.build(db)when a full syntax node is requiredcollect_green_nodesto work directly with green nodes instead of constructing syntax nodes