Skip to content
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

Symbol-typed CST nodes #1

Open
conartist6 opened this issue Aug 16, 2024 · 0 comments
Open

Symbol-typed CST nodes #1

conartist6 opened this issue Aug 16, 2024 · 0 comments
Assignees

Comments

@conartist6
Copy link
Member

Change { type: 'Name' } to { type: Symbol('Name') } across our APIs. This is expected to bring a roughly 2x speedup to equality checks against node.type due to the extremely straightforward nature of symbol comparison. String comparison does have relatively fast cases for interned strings, but likely the fact that comparison between two interned strings is only one of many possible types of string comparison means that string comparison is will probably continue to be slower than symbol comparison well into the future.

The real implementation cannot be { type: Symbol('Name') } though, as the Symbol('Name') expression must be created only once so that all references to the Name production can do so using the same symbol. The VM will need to manage these symbols, making them available through context.

@stirlhoss stirlhoss self-assigned this Aug 16, 2024
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

No branches or pull requests

2 participants