-
-
Notifications
You must be signed in to change notification settings - Fork 714
perf(linter): remove simple phf_map! calls
#14701
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
perf(linter): remove simple phf_map! calls
#14701
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 #14701 will improve performances by 4%Comparing Summary
Benchmarks breakdown
Footnotes
|
a55ef9e to
b42a79f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Replaces several small phf_map! constant maps with direct match-based lookup functions to reduce constant overhead and improve linting performance.
- Removes phf dependencies in multiple lint rule files, introducing simple helper lookup functions.
- Adjusts call sites to use Option-returning lookup functions instead of iterating map entries.
- Refactors plugin name prefix resolution from a static map to a match expression.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| prefer_query_selector.rs | Replaced small identifier map with get_preferred_identifier_name match function and updated diagnostic/fixer usage. |
| prefer_modern_dom_apis.rs | Converted two small maps (methods and positions) to match-based lookup helpers. |
| prefer_tag_over_role.rs | Replaced role→tag map with get_tags_from_role; simplified role checking logic. |
| no_redundant_roles.rs | Replaced default role exceptions map with get_default_role_exception helper. |
| aria_props.rs | Replaced common ARIA typos map with get_common_aria_prop_typo helper. |
| no_deprecated_functions.rs | Converted deprecated function map to deprecated_functions_map lookup function; updated fix application. |
| prefer_numeric_literals.rs | Replaced radix ordered set map with radix_map returning a tuple (name, prefix). |
| context/mod.rs | Removed PLUGIN_PREFIXES map and implemented plugin_name_to_prefix via match; eliminated associated comment. |
Comments suppressed due to low confidence (1)
crates/oxc_linter/src/context/mod.rs:1
- Previously there was a doc comment explaining this mapping; after inlining with match it was removed. Add a brief doc comment above plugin_name_to_prefix to clarify that it normalizes short plugin identifiers to their fully prefixed names.
#![expect(rustdoc::private_intra_doc_links)] // useful for intellisense
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
NICE! |
Merge activity
|
b42a79f to
86ecae1
Compare

Large
phf_map!calls can be worth the cost, but small ones are probably not worth it. Profiling showed that a number of these small maps add some constant overhead when linting, so I've replaced them with some simple match calls.