Slow load with high number of JS requests
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
People
(Reporter: arnaud.barre72, Unassigned)
References
(Blocks 1 open bug)
Details
Steps to reproduce:
https://github.com/ArnaudBarre/vite-slow-devtools
In short: have a vite dev server serving 3 thousand small JS files
Actual results:
The page is very slow to load compare to Chrome&Safari.
I noticed that while reporting the issue about the lag in the Chome devtools: https://bugs.chromium.org/p/chromium/issues/detail?id=1457783
Maybe this is due to having all imports in the same file (not common even in big apps). On a small/medium Vite app size, I never noticed that firefox was slower
Expected results:
The page should load of JS files over localhost should be a lot faster.
While this problem should not arise in production application, this can happen in development with tools like Vite. This is currently a blocker for people with big application (>2k JS files) trying to migrate from Webpack to Vite.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::JavaScript Engine' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•2 years ago
•
|
||
(In reply to Arnaud Barré from comment #0)
Steps to reproduce:
This link shows a 404 error on github for me.
The linked Chromium bug (https://bugs.chromium.org/p/chromium/issues/detail?id=1447912#c3) has another test-URL (https://simonsiefke.github.io/chrome-issue-1447912/) that loads 1000 CSS files. That takes a while to load : https://share.firefox.dev/3PqbBsB
@Arnaud: Can you fix the test page link (https://github.com/ArnaudBarre/vite-slow-devtools) ?
| Reporter | ||
Comment 3•2 years ago
|
||
Sorry I updated the visibility of the repo
Comment 4•2 years ago
|
||
Here's a profile:
https://share.firefox.dev/3PzAz94
Jon: This seems to be triggering some sort of algorithmic pathology.
I was able to reproduce locally by
- Cloning linked repo
- Installing dependencies with
npm install --local - Generating with
node generate.js - Serving with
npm exec vite dev
Briefly looking at the code, it seems like this is a big file with 3k import * from x.js statements, where each x.js simply exports a constant.
Comment 5•1 year ago
|
||
I can reproduce this. It looks like some quadratic behaviour is happening with us repeatedly calling the module resolve hook.
It's possible that the modules refactoring work will help here.
- m-c on 2024.06.21: https://share.firefox.dev/4ctX1IE
time spending on ModuleLoaderBase::InstantiateModuleGraph: 65,732ms 82% - m-c with module refactoring (bug 1820594): https://share.firefox.dev/4cbAuRq
time spending on ModuleLoaderBase::InstantiateModuleGraph: 9,030 ms 36%
Updated•1 year ago
|
Description
•