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

Improve chunk assignment performance #4736

Merged
merged 5 commits into from Dec 10, 2022

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:

Description

This refactors the chunk generation algorithm to hopefully improve the performance for very large projects. Basically instead of doing an ad-hoc reverse search for each module in each dynamic chunk if it may already be in memory when the chunk is loaded, when pre-create a table of modules that are in memory for each dynamic chunk. It has still some run time complexity, but my hope is that it will perform much better than the old algorithm.

@github-actions
Copy link

github-actions bot commented Dec 4, 2022

Thank you for your contribution! ❤️

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

npm install rollup/rollup#improve-chunk-assignment-performance

or load it into the REPL:
https://rollupjs.org/repl/?pr=4736

@codecov
Copy link

codecov bot commented Dec 4, 2022

Codecov Report

Merging #4736 (acd21ab) into master (2c23141) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4736   +/-   ##
=======================================
  Coverage   99.03%   99.03%           
=======================================
  Files         217      217           
  Lines        7703     7707    +4     
  Branches     2130     2133    +3     
=======================================
+ Hits         7629     7633    +4     
  Misses         24       24           
  Partials       50       50           
Impacted Files Coverage Δ
cli/run/batchWarnings.ts 98.34% <100.00%> (ø)
src/Chunk.ts 100.00% <100.00%> (ø)
src/Module.ts 100.00% <100.00%> (ø)
src/ast/utils/PathTracker.ts 100.00% <100.00%> (ø)
src/utils/chunkAssignment.ts 100.00% <100.00%> (ø)
src/utils/getOrCreate.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lukastaegert lukastaegert force-pushed the improve-chunk-assignment-performance branch from 9b18ffc to dc0f100 Compare December 10, 2022 05:55
@lukastaegert lukastaegert merged commit f368adf into master Dec 10, 2022
@lukastaegert lukastaegert deleted the improve-chunk-assignment-performance branch December 10, 2022 06:14
@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.7.2. You can test it via npm install rollup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants