-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolver perf: Prefer Maps over dynamic objects for normalised `expor…
…ts` field (5/n) (#1335) Summary: Pull Request resolved: #1335 In V8, dynamic objects (that cannot use a hidden class optimisation) are slow - `Map` is both more performant and generally safer. By normalising the `exports` field to a `Map` object (once, as normalisations are cached), subsequent lookup, iteration and reduction is considerably faster, improving `resolvePackageTargetFromExports` around 2x. This is an implementation detail of `PackageExportsResolve.js`, the normalised format is not exposed outside that module. This brings total resolution time for RNTester down below 100ms, vs >1500ms at the beginning of this stack. (I'll allow myself a 🚀 for that). Changelog: ``` - **[Performance]**: Prefer `Map` to dynamic JS objects in package exports resolver. ``` Reviewed By: huntie Differential Revision: D61850544 fbshipit-source-id: 3c741d3250c40af8975529569217590749ec804b
- Loading branch information
1 parent
16d2205
commit 5b23317
Showing
1 changed file
with
36 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters