perf: improve regex performance by bluwy · Pull Request #17789 · vitejs/vite (original) (raw)
Description
Follow-up from #17788
This PR enables eslint typechecking when it runs in IDEs as typechecking is slow to be enabled by default. I fiddled with other options, but this seems like the best balance that doesn't affect local DX but still encourages better code written.
With that setup (and the rules added from #17788), I'm able to detect additional places where some regex refactors help improve performance, especially for using RegExp#exec is faster than String#match.
I had previously ran some benchmarks from lukeed/polka#210, which showed that RegExp#exec is consistently faster than String#match, especially for longer regex or strings.