question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

https://github.com/vitejs/vite/issues/1207#issuecomment-753564633

Vite’s current biggest performance bottleneck is first page load with large amount of modules. This is mostly caused by congestion at the browser network layer, since every module results in a full HTTP GET request on fresh server start.

To improve this, we can dump the in memory transform cache to disk on server close, and “hydrate” the module graph on next server start (the hydration should only fill in the cache for files with still fresh mtimeMs). The cache can be dumped in one file so it should be relatively fast to deal with. This allows the server to directly send 304s even on a restart.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:112
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

22reactions
AlonMizcommented, Jul 9, 2021

we started to migrate our monorepo to vite. our biggest frontend project has around 2800 modules on load. we were able to reduce it to 1800 with lazyload after some work. currently, we offer vite as an alternative alongside webpack, but it’s not the default bundler yet, in dev. the main reason why we can’t deprecate our webpack dev in favor of vite alternative is that it takes a long time to reload the page. the load of 1800 creates a great bottleneck, and in our case, it can take from 10s to 20s depending on how much load there’s on the developer machine.

Suggestion: cache the files with a service worker, that after the first load, at least any consecutive load would be fast, and when a module is being changed that info can be transmitted by the hmr mechanism/websocket and deprecate the out of dated module.

14reactions
AlonMizcommented, Dec 31, 2021

@AlonMiz, curious if you’ve improved your load performance in the interim – we’ve got a project on a similar scale facing the same sorts of issues. Would love to compare notes!

Unfortunately, we’ve halted the vite migration from webpack. We couldn’t find an intermediate solution for this. Developers preferred one slow load and fast refreshes than fast first load and long refreshes

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Persistent Cache - W3C
The file cache is intended for intermediate term storage of documents or data objects. The libwww cache is a fully HTTP/1.1 compliant client...
Read more >
Persistent Lookup Cache - Informatica Documentation
A persistent lookup cache is a cache that the Integration Service reuses for multiple runs of the same mapping. Use a persistent lookup...
Read more >
persistent-cache - npm
A simple module to persistently store/cache arbitrary data.. Latest version: 1.1.2, last published: a year ago. Start using persistent-cache ...
Read more >
Persistent cache - Learning Informatica PowerCenter 10.x
When you use non-persistent cache every day, the same data will be stored in cache; this will waste time and space every day....
Read more >
Persisting Caches - Oracle Help Center
Coherence persistence is a set of tools and technologies that manage the persistence and recovery of Coherence distributed caches. Cached data is persisted ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found