perf(linter/only-used-in-recursion): improve skip_to_next_char slicing#17374
Conversation
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 #17374 will not alter performanceComparing Summary
Footnotes
|
571e6dc to
e188d8c
Compare
79e0eff to
43466f1
Compare
e188d8c to
23857c2
Compare
43466f1 to
75df67b
Compare
Merge activity
|
…ing (#17374) This only really has an effect on the `react.development.js` benchmark, where I noticed we end up spending a lot of time in `skip_to_next_char`. Instead of iterating over the entire source, we slice from the start index and use `char_indices` from there. The start index _should_ always be at a char boundary, so there shouldn't be any risk of UTF-8 issues at slicing in middle of a character. I also took the opportunity to improve how trailing commas are handled and make the fix a little bit better and add another test case. <img width="730" height="441" alt="image" src="https://github.com/user-attachments/assets/680c5cfe-7cf1-4760-926f-fb2a1dc25a8f" />
23857c2 to
eecee5d
Compare
75df67b to
c27514c
Compare

This only really has an effect on the
react.development.jsbenchmark, where I noticed we end up spending a lot of time inskip_to_next_char.Instead of iterating over the entire source, we slice from the start index and use
char_indicesfrom there. The start index should always be at a char boundary, so there shouldn't be any risk of UTF-8 issues at slicing in middle of a character.I also took the opportunity to improve how trailing commas are handled and make the fix a little bit better and add another test case.