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 Fast Refresh responsiveness when watching a large number of files #913

Closed
wants to merge 1 commit into from

Conversation

robhogan
Copy link
Contributor

@robhogan robhogan commented Jan 4, 2023

Summary:
Following D40829941 (7191173), where we changed the output of metro-file-map's build() to return "live" references to the file system and the Haste module map (rather than snapshots), we no longer require further snapshots to be emitted as part of a change event payload. In fact, ChangeEvent['snapshotFS'] and ChangeEvent['moduleMap'] are currently only referenced in test code.

Removing them means we don't have to copy potentially large data structures on each emitted change.

With ~300k files and ~150k Haste map entries, this amounts to ~200ms more responsive fast refresh - in general this boost will be proportional to the total number of files+Haste modules watched.

After this, a HasteFS instance is only constructed once, on Metro startup. That clears the way for an alternative (more expensive to initialise) implementation capable of performing lookups through symlinks.

Changelog: [Performance] Improve Fast Refresh responsiveness when watching a large number of files.

Reviewed By: motiz88

Differential Revision: D42303139

…iles

Summary:
Following D40829941 (facebook@7191173), where we changed the output of `metro-file-map`'s `build()` to return "live" references to the file system and the Haste module map (rather than snapshots), we no longer require further snapshots to be emitted as part of a change event payload. In fact, `ChangeEvent['snapshotFS']` and `ChangeEvent['moduleMap']` are currently only referenced in test code.

Removing them means we don't have to copy potentially large data structures on each emitted change.

With ~300k files and ~150k Haste map entries, this amounts to ~200ms more responsive fast refresh - in general this boost will be proportional to the total number of files+Haste modules watched.

After this, a `HasteFS` instance is only constructed once, on Metro startup. That clears the way for an alternative (more expensive to initialise) implementation capable of performing lookups through symlinks.

Changelog: [Performance] Improve Fast Refresh responsiveness when watching a large number of files.

Reviewed By: motiz88

Differential Revision: D42303139

fbshipit-source-id: ebafcc8a698d9a659e4da37a935d4a4e5961fb65
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Jan 4, 2023
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in b942eca.

@robhogan robhogan deleted the export-D42303139 branch January 4, 2023 17: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