perf(rspack_core): add cache to depended_modules in code splitter
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
- [x] New feature / Improvement
- [ ] Refactoring
- [ ] Breaking change
Checklist
- [ ] I have added changeset via
pnpm run changeset. - [ ] I have added tests to cover my changes.
⚠️ No Changeset found
Latest commit: 1ac354073a182097ed80ee56001599ba28ccc444
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
@hyf0 this has a better perf improvement, please take a look.