Closed Bug 1379934 Opened 7 years ago Closed 6 years ago

Modules scripts loading very slowly on some module trees

Categories

(Core :: JavaScript Engine, defect, P3)

54 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1365187

People

(Reporter: guybedford, Unassigned)

References

Details

(Keywords: perf, triage-deferred)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

Steps to reproduce:

1. Clone https://github.com/guybedford/modules-slow-tree
2. Run a local server
3. Open test.html


Actual results:

I've put together an example module tree extracted from Babel, with the actual code removed, and just keeping the relations between 170 modules.

Typically, 170 modules load fine, but this particular tree seems to result in unnecessary overhead, taking over 10s to be processed. In Safari this tree is loaded in under 200ms.


Expected results:

There shouldn't have to be this much unnecessary processing in the module pipeline. It sounds like there is a much higher order looping than necessary for this particular graph, perhaps due to circularity.
Component: Untriaged → JavaScript Engine
Keywords: perf
Product: Firefox → Core
Keywords: triage-deferred
Priority: -- → P3
I'd like to request that this issue is reprioritized as an issue blocking the unflagged release of ES modules in Firefox. Every other browser can handle this cases like these in seconds, while Firefox can easily be crashed by a case like this of twice the size, which would thus bring down the whole ecosystem in terms of what can be supported in practical usage of modules.
Blocks: modules-0
This is probably a duplicate of bug 1365187.
Thanks for the update.

Perhaps try the test on the new build to check the perf if you feel like stress testing it!

Feel free to close as a duplicate too.

I'll try it out as soon as it lands on nightly and report back either way.
I get "SyntaxError: import not found: default". It does seems to request a ton of modules before that.
Thanks Tom for the update. The error is correct behaviour in this case.
Note though that anything over 1 second load time for the module requests is a sign of unnecessary algorithmic complexity.
Confirmed that this no longer takes ~10s on latest nightly.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Excellent thanks so much for your work on this, I can confirm it is now working well. It still seems like it is a few x slower than Chrome, but this is a massive improvement.
You need to log in before you can comment on or make changes to this bug.