Skip to content

perf(linter): avoid iteration when checking import is AllButDefault or SideEffect in eslint/no-duplicate-imports #12093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Sysix
Copy link
Member

@Sysix Sysix commented Jul 6, 2025

Avoid the 3 iterations

    let namespace = existing.iter().find(|(t, _, _)| matches!(t, ImportType::Namespace));
    let named = existing.iter().find(|(t, _, _)| matches!(t, ImportType::Named));
    let default = existing.iter().find(|(t, _, _)| matches!(t, ImportType::Default));

when the ImportType is SideEffect or AllButDefault. Their results are not needed for the two types.

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

Sysix commented Jul 6, 2025


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.

Copy link

codspeed-hq bot commented Jul 6, 2025

CodSpeed Instrumentation Performance Report

Merging #12093 will degrade performances by 13.32%

Comparing 07-06-perf_linter_avoid_iteration_when_checking_import_is_allbutdefault_or_sideeffect_in_eslint_no-duplicate-imports_ (04e2de5) with main (9240342)

Summary

❌ 1 regressions
✅ 37 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[cal.com.tsx] 3.1 ms 3.5 ms -13.32%

@Sysix Sysix marked this pull request as ready for review July 6, 2025 12:19
@Sysix Sysix requested a review from camc314 as a code owner July 6, 2025 12:19
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jul 6, 2025
Copy link
Contributor

camc314 commented Jul 6, 2025

Merge activity

… or `SideEffect` in `eslint/no-duplicate-imports` (#12093)

Avoid the 3 iterations

```
    let namespace = existing.iter().find(|(t, _, _)| matches!(t, ImportType::Namespace));
    let named = existing.iter().find(|(t, _, _)| matches!(t, ImportType::Named));
    let default = existing.iter().find(|(t, _, _)| matches!(t, ImportType::Default));
```

when the `ImportType` is `SideEffect` or `AllButDefault`. Their results are not needed for the two types.
@graphite-app graphite-app bot force-pushed the 07-06-perf_linter_avoid_iteration_when_checking_import_is_allbutdefault_or_sideeffect_in_eslint_no-duplicate-imports_ branch from 1793659 to 04e2de5 Compare July 6, 2025 13:09
@graphite-app graphite-app bot merged commit 04e2de5 into main Jul 6, 2025
23 checks passed
@graphite-app graphite-app bot deleted the 07-06-perf_linter_avoid_iteration_when_checking_import_is_allbutdefault_or_sideeffect_in_eslint_no-duplicate-imports_ branch July 6, 2025 13:12
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 6, 2025
@oxc-bot oxc-bot mentioned this pull request Jul 7, 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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy