Skip to content

Make hash_combine support enums automatically#42651

Closed
NickGerleman wants to merge 2 commits into
react:mainfrom
NickGerleman:export-D53074535
Closed

Make hash_combine support enums automatically#42651
NickGerleman wants to merge 2 commits into
react:mainfrom
NickGerleman:export-D53074535

Conversation

@NickGerleman

Copy link
Copy Markdown
Contributor

Summary:
Lots of boilerplate to define hash functions for different enums, so we can use them in hash_combine.

This change makes it so that hash_combine will automatically hash underlying type of enums.

I chose not to specialize enums generically with std::hash functor because it feels like we shouldn't leak that. But hash_combine we can make this change to.

Changelog: [Internal]

Differential Revision: D53074535

Summary:
We are making some decently large changes around here, to transition Fabric away from Yoga's private API, and add new units, and CSS properties. Even confined to Fabric, we have a large matrix of different paths for parsing.

This change consolidates layout props parsing to a single, tested path, used everywhere.

Concretely, this means removing:
1. MapBuffer for ViewProps
2. Iterator style props parsing (for layout props only)

MapBuffer for ViewProps to my understanding is not currently used at all, and has been live to edits, but untested, for quite some time. Iterator style props parsing is still enabled in some configurations, but we don't want to broadly ship its current form, and haven't been able to prioritize shipping it.

Both MapBuffer, and iterator style props parser, are performance wins. If we look at seriously shipping one of these again, we should look at swapping out the current path.

Changelog: [Internal]

Differential Revision: D53072714
Summary:
Lots of boilerplate to define hash functions for different enums, so we can use them in `hash_combine`.

This change makes it so that `hash_combine` will automatically hash underlying type of enums.

I chose not to specialize enums generically with `std::hash` functor because it feels like we shouldn't leak that. But `hash_combine` we can make this change to.

Changelog: [Internal]

Differential Revision: D53074535
@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 Jan 25, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@analysis-bot

Copy link
Copy Markdown
Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 16,972,305 +7
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 20,356,085 +6
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: f322dc7
Branch: main

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 30, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 359738b.

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 This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants