Skip to content
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

Fix performance regression when a file is imported by many importers #3641

Merged
merged 2 commits into from Jun 17, 2020

Conversation

lukastaegert
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
Resolves #3640

Description

In Rollup 2.9.0, new properties importers and dynamicImporters were added to this.getModuleInfo. While the graph was built, these properties were extended ver often for some files (in the example in #3640, react and another file were imported both by more than 5000 files).
These properties were also sorted and the logic was built in a way so that the properties were sorted after any new importer was added. Now if you add 5000 properties to an array and sort the array after each added property, this does not scale well.

This PR fixes this regression by only sorting when the this.getModuleInfo is actually called.

@rollup-bot
Copy link
Collaborator

rollup-bot commented Jun 16, 2020

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#fix-load-performance-regression

or load it into the REPL:
https://rollupjs.org/repl/?circleci=11987

@codecov
Copy link

codecov bot commented Jun 16, 2020

Codecov Report

Merging #3641 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3641   +/-   ##
=======================================
  Coverage   96.54%   96.54%           
=======================================
  Files         183      183           
  Lines        6244     6244           
  Branches     1830     1832    +2     
=======================================
  Hits         6028     6028           
  Misses        107      107           
  Partials      109      109           
Impacted Files Coverage Δ
src/Graph.ts 100.00% <ø> (ø)
src/ModuleLoader.ts 100.00% <ø> (ø)
src/ast/nodes/MemberExpression.ts 98.30% <100.00%> (ø)
src/utils/escapeId.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc2182d...ea250ee. Read the comment docs.

@lukastaegert lukastaegert merged commit 472b4be into master Jun 17, 2020
@lukastaegert lukastaegert deleted the fix-load-performance-regression branch June 17, 2020 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build time explodes with version higher than 2.8.2 and @material-ui/icons
2 participants