Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(linter/jsx-no-comment-textnodes): remove regex for checking comm…
…ent patterns (#6534) Improves performance of this rule by replacing `Regex` with simpler string methods. On the `RadixUIAdoptionSection.jsx` file alone, this improves performance by ~5%: ``` hyperfine --warmup 100 --shell=none --runs 3000 './oxlint-main -W jsx-no-comment-textnodes --silent ./RadixUIAdoptionSection.jsx' './oxlint-jsx-no-comment-textnodes-no-regex -W jsx-no-comment-textnodes --silent ./RadixUIAdoptionSection.jsx' Benchmark 1: ./oxlint-main -W jsx-no-comment-textnodes --silent ./RadixUIAdoptionSection.jsx Time (mean ± σ): 4.4 ms ± 0.1 ms [User: 1.7 ms, System: 1.9 ms] Range (min … max): 4.1 ms … 5.3 ms 3000 runs Benchmark 2: ./oxlint-jsx-no-comment-textnodes-no-regex -W jsx-no-comment-textnodes --silent ./RadixUIAdoptionSection.jsx Time (mean ± σ): 4.2 ms ± 0.1 ms [User: 1.5 ms, System: 1.8 ms] Range (min … max): 3.9 ms … 5.0 ms 3000 runs Summary ./oxlint-jsx-no-comment-textnodes-no-regex -W jsx-no-comment-textnodes --silent ./RadixUIAdoptionSection.jsx ran 1.06 ± 0.05 times faster than ./oxlint-main -W jsx-no-comment-textnodes --silent ./RadixUIAdoptionSection.jsx ```
- Loading branch information