perf(linter): id-length: check if ident is ASCII before segmenting#14767
Merged
graphite-app[bot] merged 1 commit intomainfrom Oct 20, 2025
Conversation
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #14767 will not alter performanceComparing Summary
Footnotes
|
1e5e67e to
949a636
Compare
b42a79f to
86ecae1
Compare
949a636 to
60a9f3d
Compare
camc314
approved these changes
Oct 20, 2025
Contributor
Merge activity
|
…14767) Profiling shows that segmenting into graphemes is much slower than just looking at the number of bytes. A simple check on `is_ascii` allows us to avoid splitting into graphemes and use the identifier length instead, which is much faster. We could optimize this further in the future by doing some faster ASCII check, but this is a good start.
60a9f3d to
92b4302
Compare
graphite-app bot
pushed a commit
that referenced
this pull request
Oct 20, 2025
…ks (#14821) Previous PR (#14767) implemented an initial ASCII check, but I forgot to add it to the other identifier checks as well. This now adds the fast path ASCII check to all of the branches for this rule. In addition, we no longer need to call `.to_string()` to allocate for each identifier, we can simply do the exceptions check with `&str`. This should greatly benefit large files which have lots of identifiers, but this will pretty much universally improve perf on every file since this rule runs on every identifier and almost every JS file has identifiers. <img width="714" height="535" alt="image" src="https://github.com/user-attachments/assets/f67a43e8-0e91-4f6d-805b-a031f9881c74" />
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.

Profiling shows that segmenting into graphemes is much slower than just looking at the number of bytes. A simple check on
is_asciiallows us to avoid splitting into graphemes and use the identifier length instead, which is much faster. We could optimize this further in the future by doing some faster ASCII check, but this is a good start.