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

perf(core): improve cold startup performance by caching depended_modules function in code splitter #2294

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

Boshen
Copy link
Contributor

@Boshen Boshen commented Mar 16, 2023

Summary

Code splitting has a hot path on depended_modules, this PR caches the result.
In a project a with 20k modules, code splitting time is reduced from 6s to 2s.

Related issue (if exists)

Types of changes

  • Docs change / Dependency upgrade
  • Bug fix
  • New feature / Improvement
  • Refactoring
  • Breaking change

Checklist

  • I have added changeset via pnpm run changeset.
  • I have added tests to cover my changes.

@Boshen Boshen requested a review from hyf0 March 16, 2023 07:33
@changeset-bot
Copy link

changeset-bot bot commented Mar 16, 2023

⚠️ No Changeset found

Latest commit: 1ac3540

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Mar 16, 2023
@Boshen Boshen force-pushed the cache-depended-modules branch 3 times, most recently from 805f01a to 70519c8 Compare March 20, 2023 02:21
@Boshen
Copy link
Contributor Author

Boshen commented Mar 20, 2023

@hyf0 this has a better perf improvement, please take a look.

hyf0
hyf0 previously approved these changes Mar 20, 2023
@hyf0 hyf0 requested a review from h-a-n-a as a code owner April 17, 2023 07:11
@hyf0 hyf0 self-assigned this Apr 17, 2023
@hyf0 hyf0 changed the title perf(rspack_core): add cache to depended_modules in code splitter perf(core): add cache to depended_modules in code splitter Apr 17, 2023
Copy link
Collaborator

@hyf0 hyf0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the latency.

@hyf0 hyf0 added this to the Next patch - 0.1.X milestone Apr 17, 2023
@hyf0 hyf0 changed the title perf(core): add cache to depended_modules in code splitter perf(core): improve cold startup performance by caching depended_modules function in code splitter Apr 17, 2023
@hyf0 hyf0 added this pull request to the merge queue Apr 17, 2023
Merged via the queue into main with commit b53d948 Apr 17, 2023
12 checks passed
@hyf0 hyf0 deleted the cache-depended-modules branch April 17, 2023 07:24
siyou pushed a commit to siyou/rspack that referenced this pull request May 14, 2023
…ules` function in code splitter (web-infra-dev#2294)

perf(rspack_core): add cache to depended_modules in code splitter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants