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

Resolver perf: Optimise package exports flattenLegacySubpathValues (1/n) #1318

Closed
wants to merge 1 commit into from

Conversation

robhogan
Copy link
Contributor

Summary:
The performance results from this stack are based on replaying the ~3000 resolutions performed during bundling RN Tester directly through DependencyGraph.resolveDependency. The baseline resolution time is ~1500ms on an M1 Max. (Internal: details in test plan)

This is a self-contained optimsation to the flattenLegacySubpathValues step as part of exports map normalisation, which takes over 20% (360ms) of total resolver CPU time over 655 calls due largely to repeated object allocations and spreads. By mutating an intermediate object instead we get this down to ~16ms.

Note that this still preserves key order - export maps are ordered.

This reduces total resolution time from 1540ms -> 1171ms (-23%)

Differential Revision: D56701232

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 12, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D56701232

…(1/n) (#1318)

Summary:
Pull Request resolved: #1318

The performance results from this stack are based on replaying the ~3000 resolutions performed during bundling RN Tester directly through `DependencyGraph.resolveDependency`. The baseline resolution time is ~1500ms on an M1 Max. (Internal: details in test plan)

This is a self-contained optimsation to the `flattenLegacySubpathValues` step as part of exports map normalisation, which takes over 20% (360ms) of total resolver CPU time over 655 calls due largely to repeated object allocations and spreads. By mutating an intermediate object instead we get this down to ~16ms.

Note that this still preserves key order - export maps are ordered.

This reduces total resolution time from 1540ms -> 1171ms (-23%)

Reviewed By: huntie

Differential Revision: D56701232
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D56701232

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 021e890.

@robhogan robhogan deleted the export-D56701232 branch August 12, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants