Skip to content

perf(linter/import/extensions): skip empty config and borrow extensions#24075

Merged
graphite-app[bot] merged 1 commit into
mainfrom
codex/import-extensions-perf
Jul 2, 2026
Merged

perf(linter/import/extensions): skip empty config and borrow extensions#24075
graphite-app[bot] merged 1 commit into
mainfrom
codex/import-extensions-perf

Conversation

@camc314

@camc314 camc314 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • split out the remaining safe import/extensions performance slice from perf(linter): speed up hot rules on large codebases #23829 for easier review and bisectability
  • skip the rule work early when the config is effectively empty/default and there is nothing to enforce
  • parse written extensions as Cow<str> so common lowercase specifiers stay borrowed
  • preserve the existing written-extension behavior for cases like written .js resolving to .ts

Credit to Yagiz Nizipli for the original work in #23829.

Co-authored-by: Yagiz Nizipli yagiz@nizipli.com

Copilot AI review requested due to automatic review settings July 2, 2026 15:27
@github-actions github-actions Bot added the A-linter Area - Linter label Jul 2, 2026
@camc314 camc314 changed the title perf(linter/import): speed up extensions checks perf(linter/import/extensions): skip empty config and borrow extensions Jul 2, 2026
@camc314 camc314 self-assigned this Jul 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 import/extensions linter rule hot path by avoiding unnecessary work when the rule has no effective configuration, and by reducing allocations when parsing written extensions.

Changes:

  • Add an early return in process_import when config is effectively empty/default (no rules to enforce).
  • Change written-extension parsing to return Cow<str> so lowercase extensions can stay borrowed instead of allocating.
  • Minor refactor of query-string stripping in extension parsing (split_once('?')).

Comment thread crates/oxc_linter/src/rules/import/extensions.rs Outdated
@camc314

camc314 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: d969992a39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codspeed-hq

codspeed-hq Bot commented Jul 2, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 66 skipped benchmarks1


Comparing codex/import-extensions-perf (d969992) with main (e6cee89)

Open in CodSpeed

Footnotes

  1. 66 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.

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jul 2, 2026

camc314 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

…ns (#24075)

## Summary
- split out the remaining safe `import/extensions` performance slice from #23829 for easier review and bisectability
- skip the rule work early when the config is effectively empty/default and there is nothing to enforce
- parse written extensions as `Cow<str>` so common lowercase specifiers stay borrowed
- preserve the existing written-extension behavior for cases like written `.js` resolving to `.ts`

Credit to Yagiz Nizipli for the original work in #23829.

Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
@graphite-app graphite-app Bot force-pushed the codex/import-extensions-perf branch from d969992 to b1be114 Compare July 2, 2026 15:43
@graphite-app graphite-app Bot merged commit b1be114 into main Jul 2, 2026
29 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jul 2, 2026
@graphite-app graphite-app Bot deleted the codex/import-extensions-perf branch July 2, 2026 15:48
camc314 added a commit that referenced this pull request Jul 3, 2026
…ns (#24075)

## Summary
- split out the remaining safe `import/extensions` performance slice from #23829 for easier review and bisectability
- skip the rule work early when the config is effectively empty/default and there is nothing to enforce
- parse written extensions as `Cow<str>` so common lowercase specifiers stay borrowed
- preserve the existing written-extension behavior for cases like written `.js` resolving to `.ts`

Credit to Yagiz Nizipli for the original work in #23829.

Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
camc314 added a commit that referenced this pull request Jul 3, 2026
…ns (#24075)

## Summary
- split out the remaining safe `import/extensions` performance slice from #23829 for easier review and bisectability
- skip the rule work early when the config is effectively empty/default and there is nothing to enforce
- parse written extensions as `Cow<str>` so common lowercase specifiers stay borrowed
- preserve the existing written-extension behavior for cases like written `.js` resolving to `.ts`

Credit to Yagiz Nizipli for the original work in #23829.

Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants