perf(lib): reduce backtrack when injecting esbuild helpers (fixes #8099)#8110
Conversation
bluwy
left a comment
There was a problem hiding this comment.
Interesting. Didn't know this technique has perf implications too.
|
Thanks for the quick fix @sapphi-red! I also didn't know there was so much difference... wow. |
|
FYI, the following list is the step counts for some regexp. target string:
This step count is by PCRE (not the one used in V8) so it is different from Node.js(V8) but it would be simillar. If you change the target string to |
Description
This line was consuming a lot of time.
vite/packages/vite/src/node/plugins/esbuild.ts
Lines 276 to 279 in bb603d3
This PR changes regex to reduce backtracks.
I confirmed #8099 works with this PR.
#8099 is about umd but it happens with iife in theory and this PR fixes it too.
fixes #8099
refs #7948
Additional context
rollup repl (named exports + iife)
rollup repl (named exports + umd)
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).