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(lib): reduce backtrack when injecting esbuild helpers (fixes #8099) #8110
perf(lib): reduce backtrack when injecting esbuild helpers (fixes #8099) #8110
Conversation
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.
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
).