perf(linter): jest/no-confusing-set-timeout: do not lowercase import name#17324
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 #17324 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes the jest/no-confusing-set-timeout linter rule by removing redundant string allocations that were occurring before case-insensitive comparisons. The change eliminates an unnecessary cow_to_ascii_lowercase() call since eq_ignore_ascii_case() already performs case-insensitive ASCII comparison, resulting in a +1% performance improvement on benchmarks.
- Replaced
name.cow_to_ascii_lowercase().eq_ignore_ascii_case("jest")withname.eq_ignore_ascii_case("jest") - Removed the now-unused
cow_utils::CowUtilsimport - Additional refactoring: consolidated duplicate
scoping()calls into a single variable and optimized early return placement inis_jest_fn_call
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
…name (#17324) Lowercasing the imported name here causes allocations and is redundant since then explicitly do a case-insensitive ASCII check afterwards. For most (all?) cases, just doing the case-insensitive check should be fine. (For ASCII, I'm fairly sure these are the same. Of course with Unicode it's much more complicated, but we shouldn't need to worry about that here too much.) +1% on benchmarks. <img width="716" height="433" alt="Screenshot 2025-12-23 at 8 55 24 PM" src="https://github.com/user-attachments/assets/40f1f9e1-72dd-4698-baa4-587fb9d4d361" />
3126f20 to
687ffd6
Compare

Lowercasing the imported name here causes allocations and is redundant since then explicitly do a case-insensitive ASCII check afterwards. For most (all?) cases, just doing the case-insensitive check should be fine.
(For ASCII, I'm fairly sure these are the same. Of course with Unicode it's much more complicated, but we shouldn't need to worry about that here too much.)
+1% on benchmarks.
