In `node_syntax_kind()` look into a way to use `.kind_id()` rather than `.kind()`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 446
- Forks
- 32
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 1
Description
In theory, build a map of x.kind_id() to RSyntaxKind once on startup using something like parser.language().unwrap().id_for_node_kind(kind, named) so we can match against x.kind_id() rather than x.kind().
I think match against an integer should be faster than against a string. Plus .kind_id() is going to be cheaper than .kind(), because in .kind() there is UTF-8 validation every time we call it (since it comes from a CStr).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for node_syntax_kind() and read its current uses of kind() alongside the parser.language() and id_for_node_kind() APIs mentioned here. Determine how the startup mapping would be scoped and verify that matching kind_id() preserves the existing RSyntaxKind behavior; the work is done when the equivalent lookup no longer depends on repeated string access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100