Skip to content

Conversation

@eytan-starkware
Copy link
Contributor

@eytan-starkware eytan-starkware commented Oct 8, 2025

TL;DR

Cache syntax node kind to avoid database lookups.

What changed?

This PR optimizes the SyntaxNode struct by caching the node's kind and parent kind directly in the struct, rather than looking them up from the database each time they're needed. The changes include:

  1. Added kind and parent_kind fields to the SyntaxNode struct
  2. Modified the new_syntax_node function to accept and store the kind parameter
  3. Updated the kind() method to return the cached value instead of looking it up
  4. Updated the parent_kind() method to return the cached value
  5. Modified node creation functions to pass the kind when creating new nodes

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

eytan-starkware commented Oct 8, 2025

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@orizi reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)

@eytan-starkware eytan-starkware force-pushed the eytan_graphite/keeping_syntaxnode_parent_s_data_id_for_optimizations branch from 49347d0 to 010cd59 Compare October 15, 2025 11:37
@eytan-starkware eytan-starkware force-pushed the eytan_graphite/keeping_syntanode_s_kind_and_parent_kind_for_optimization branch from 79a3650 to 1353cbc Compare October 15, 2025 11:37
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orizi reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)

@eytan-starkware eytan-starkware force-pushed the eytan_graphite/keeping_syntanode_s_kind_and_parent_kind_for_optimization branch from 1353cbc to 2fb49ce Compare October 15, 2025 13:10
@eytan-starkware eytan-starkware force-pushed the eytan_graphite/keeping_syntaxnode_parent_s_data_id_for_optimizations branch from 010cd59 to c071884 Compare October 15, 2025 13:10
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orizi reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orizi reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)

@eytan-starkware eytan-starkware force-pushed the eytan_graphite/keeping_syntaxnode_parent_s_data_id_for_optimizations branch from 8dfde2b to a6b60a0 Compare October 28, 2025 12:28
@eytan-starkware eytan-starkware force-pushed the eytan_graphite/keeping_syntanode_s_kind_and_parent_kind_for_optimization branch from 3295969 to 809ced5 Compare October 28, 2025 12:28
@graphite-app graphite-app bot changed the base branch from eytan_graphite/keeping_syntaxnode_parent_s_data_id_for_optimizations to graphite-base/8515 October 28, 2025 14:18
@eytan-starkware eytan-starkware force-pushed the eytan_graphite/keeping_syntanode_s_kind_and_parent_kind_for_optimization branch from 809ced5 to 7903922 Compare October 28, 2025 14:37
@graphite-app graphite-app bot changed the base branch from graphite-base/8515 to main October 28, 2025 14:38
@graphite-app
Copy link

graphite-app bot commented Oct 28, 2025

Merge activity

  • Oct 28, 2:38 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

@eytan-starkware eytan-starkware added this pull request to the merge queue Oct 28, 2025
Merged via the queue into main with commit b46bc54 Oct 28, 2025
106 checks passed
@eytan-starkware eytan-starkware deleted the eytan_graphite/keeping_syntanode_s_kind_and_parent_kind_for_optimization branch October 28, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants