Skip to content

no-unnecessary-polyfills: Improve performance#2874

Merged
sindresorhus merged 1 commit into
mainfrom
polyfills
Feb 13, 2026
Merged

no-unnecessary-polyfills: Improve performance#2874
sindresorhus merged 1 commit into
mainfrom
polyfills

Conversation

@sindresorhus
Copy link
Copy Markdown
Owner

The rule was doing too many regex checks per import. I changed it to preselect likely matches before running regex tests. It now builds token indexes from core-js feature names and only checks candidate patterns. I also normalized polyfill-prefixed imports (polyfill-* and mdn-polyfills/*) so they use the same narrowed path instead of scanning everything.

Result: overhead on synthetic 4000-import files dropped from roughly 2x+ in some cases to about 1.0-1.06x.

@sindresorhus sindresorhus requested a review from fisker February 11, 2026 05:11
Repository owner deleted a comment Feb 11, 2026
Copy link
Copy Markdown
Collaborator

@fisker fisker left a comment

Choose a reason for hiding this comment

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

Didn't read the code, feel free to merge.

@sindresorhus sindresorhus merged commit c88bf29 into main Feb 13, 2026
35 checks passed
@sindresorhus sindresorhus deleted the polyfills branch February 13, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants