-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Improve perf of internal resolve plugin #12363
Comments
Some random ideas:
|
Yeah I think it'll be nice if we can get this fixed for windows. I saw you made a fix before to resolve Windows drive relative paths. It would need some testing to get it work, but I don't have a Windows laptop.
Yeah I think this is implemented in #12512, in a way. Since in most case we will eventually find a
I think it might be good to have Vite be package manager agnostic for now, so future pms like Bun (which saves the lockfile in binary format) will work. Maybe using lockfiles that we understand could help fast-path things, but the idea of JSON.parse or yaml-parsing them is a bit scary 😄 |
Relying on the knowledge of dependency package managers can be troublesome, and we cannot guarantee that the lockfile is up-to-date. Additionally, Yarn 1 does not guarantee a topological structure. 🤔 |
Yeah, I agree with that. I think the ability to skip the FS traverse has great potential but better to be sought as a plugin. |
Sorry for the misoperation 😅. I also have a speculative idea: is it possible to pre-scan all file structures we need one time and maintained them in memory? Could that reduce the JS/C++ communication overhead to minimal time as we can assume node_modules is immutable. 🤔 |
maybe you can try https://github.com/web-infra-dev/nodejs_resolver which we do lots of optimization |
I think that will trade more RAM instead which could be a problem for lower-end machines. We do already cache some crucial files in node_modules through the optimizer, which I think is a step towards it. Caching for source code is already somewhat there with Vite's module graph too.
It would be interesting to try that out. Right now Vite mixes a lot optimizer logic within it's node resolver, which could be refactored out. I'm also concerned of the install size of using native binaries though. IMO it would need a significant improvement to justify the size, that's one of the reason (for me) that |
Perhaps this
Since we know the id is already resolved, maybe we can skip resolveId ? (I didn't find a good way to implement this without introducing a breaking change...)
|
I think we can close this issue for now. Resolving perf in Vite 4.3 has greatly improved. We can continue looking for opportunities to speed up things further but I dont think this umbrella issue is needed now. |
Description
We need to follow Node resolution and also take into account
resolve.extensions
. Right now a single resolve call could end up exploding into many file system checks.Creating an umbrella issue to discuss ways to improve the plugin. There are other possibly related issues:
Suggested solution
To be determined.
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: