Skip to content

perf(linter): jest/no-confusing-set-timeout: do not lowercase import name#17324

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-23-perf_linter_jest_no-confusing-set-timeout_do_not_lowercase_import_name
Dec 24, 2025
Merged

perf(linter): jest/no-confusing-set-timeout: do not lowercase import name#17324
graphite-app[bot] merged 1 commit intomainfrom
12-23-perf_linter_jest_no-confusing-set-timeout_do_not_lowercase_import_name

Conversation

@camchenry
Copy link
Member

@camchenry camchenry commented Dec 24, 2025

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.
Screenshot 2025-12-23 at 8 55 24 PM

@github-actions github-actions bot added A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance labels Dec 24, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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-hq
Copy link

codspeed-hq bot commented Dec 24, 2025

CodSpeed Performance Report

Merging #17324 will not alter performance

Comparing 12-23-perf_linter_jest_no-confusing-set-timeout_do_not_lowercase_import_name (3126f20) with main (b00da37)1

Summary

✅ 4 untouched
⏩ 41 skipped2

Footnotes

  1. No successful run was found on main (a7d4878) during the generation of this report, so b00da37 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 41 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camchenry camchenry marked this pull request as ready for review December 24, 2025 01:55
@camchenry camchenry requested a review from camc314 as a code owner December 24, 2025 01:55
Copilot AI review requested due to automatic review settings December 24, 2025 01:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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") with name.eq_ignore_ascii_case("jest")
  • Removed the now-unused cow_utils::CowUtils import
  • Additional refactoring: consolidated duplicate scoping() calls into a single variable and optimized early return placement in is_jest_fn_call

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camc314 camc314 self-assigned this Dec 24, 2025
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 24, 2025
Copy link
Contributor

camc314 commented Dec 24, 2025

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" />
@graphite-app graphite-app bot force-pushed the 12-23-perf_linter_jest_no-confusing-set-timeout_do_not_lowercase_import_name branch from 3126f20 to 687ffd6 Compare December 24, 2025 11:15
@graphite-app graphite-app bot merged commit 687ffd6 into main Dec 24, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 12-23-perf_linter_jest_no-confusing-set-timeout_do_not_lowercase_import_name branch December 24, 2025 11:20
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants