-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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: preserve symlinks while scanning user code #12818
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Interesting, one down, one up for the benchmarks https://github.com/vitejs/vite-benchmark/actions/runs/4660951837. Maybe there is something wrong with the PR, I wouldn't expect things to be slower after it. |
Another run with the same result https://github.com/vitejs/vite-benchmark/actions/runs/4664331499. @fi3ework said that there could be a 1% variance that is noise though. |
I ran this locally with a project with many entires ( |
Ran twice on Windows (add a os inputs for workflow)
It shows FCP did get a perf gain 🤔. |
I did 50 times run in Linux and it shows ~0.75% improvement of the 2.7-slow case, and almost no difference in the other case: https://github.com/vitejs/vite-benchmark/actions/runs/4682746568 If this is safe, it looks like a good optimization. We can also hold it until the next minor to keep stabilizing 4.3 and getting to users sooner. |
I ran the "1000 React components" benchmark on my machine with this PR. Babel (cold start) was 4949.9ms and SWC (cold start) was 3046.5ms. |
I noticed that the scanner uses the same Package Cache with the normal pipeline. So the scanner's vite/packages/vite/src/node/optimizer/scan.ts Lines 211 to 215 in f2aadb0
vite/packages/vite/src/node/optimizer/scan.ts Lines 272 to 297 in f2aadb0
vite/packages/vite/src/node/plugins/index.ts Lines 60 to 65 in f2aadb0
|
Thanks for the review @sapphi-red. I'm no longer sure about adding the extra complexity of changing |
Description
Testing an idea we were discussing with @bluwy. We can avoid costly realPathSync calls for user code while scanning. I haven't noticed a diff in perf though. @sapphi-red maybe when you are back to your Windows machine you could try this one?
What is the purpose of this pull request?