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

[Flare] Revise responder event types #16081

Merged
merged 2 commits into from
Jul 8, 2019

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Jul 8, 2019

This changes responder event types to always be strings, rather than the confusing mix of either string or object (for when something needs to be marked as passive). So previously, you'd do this {name: 'click', passive: false}. With this change, you'd do "click_active".

From doing this, we can get rid of a bunch of confusing branch code and unify the event targets of both DOM and RN responders so they're just Array<string>. So this also removes a lot of Flow generics abstraction too.

The net result is less memory used and faster runtime performance as we no longer generate sets and listening keys, instead we loop over the small array. Looping over a small array of strings (< 10 elements) was 5x faster than converting to a key and using that as a key to lookup existence within a Set.

@sizebot
Copy link

sizebot commented Jul 8, 2019

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: 2a0f639...4f529a3

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js -0.0% 0.0% 115 KB 115 KB 36.27 KB 36.27 KB NODE_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 135.74 KB 135.74 KB 35.81 KB 35.81 KB UMD_DEV
ReactDOM-dev.js -0.2% -0.2% 916.45 KB 914.19 KB 203.61 KB 203.19 KB FB_WWW_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.34 KB 19.34 KB 7.23 KB 7.23 KB UMD_PROD
react-dom-test-utils.production.min.js 0.0% 🔺+0.1% 10.95 KB 10.95 KB 4 KB 4.01 KB UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.3% 1.21 KB 1.21 KB 705 B 707 B UMD_PROD
react-dom-test-utils.production.min.js 0.0% 0.0% 10.71 KB 10.71 KB 3.94 KB 3.95 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.05 KB 1.05 KB 636 B 637 B NODE_PROD
react-dom.development.js -0.2% -0.2% 893.31 KB 891.15 KB 203.2 KB 202.83 KB UMD_DEV
react-dom.production.min.js -0.0% 0.0% 111.28 KB 111.27 KB 35.81 KB 35.81 KB UMD_PROD
react-dom.profiling.min.js -0.0% 0.0% 114.72 KB 114.71 KB 36.87 KB 36.87 KB UMD_PROFILING
react-dom.development.js -0.2% -0.2% 887.6 KB 885.44 KB 201.7 KB 201.32 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 133.8 KB 133.8 KB 35.43 KB 35.43 KB NODE_DEV
react-dom.production.min.js -0.0% 0.0% 111.36 KB 111.35 KB 35.34 KB 35.34 KB NODE_PROD
react-dom-server.node.production.min.js 0.0% 0.0% 20.11 KB 20.11 KB 7.54 KB 7.54 KB NODE_PROD
ReactDOM-prod.js -0.2% -0.2% 371.18 KB 370.39 KB 68.17 KB 68.02 KB FB_WWW_PROD
ReactDOM-profiling.js -0.2% -0.2% 377.5 KB 376.72 KB 69.52 KB 69.37 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 131.88 KB 131.88 KB 34.89 KB 34.89 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.26 KB 19.26 KB 7.24 KB 7.24 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.76 KB 60.76 KB 15.85 KB 15.85 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.74 KB 10.74 KB 3.68 KB 3.68 KB UMD_PROD
ReactDOMServer-dev.js 0.0% 0.0% 134.27 KB 134.27 KB 34.45 KB 34.45 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 46.67 KB 46.67 KB 10.74 KB 10.74 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.43 KB 60.43 KB 15.72 KB 15.72 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.85 KB 3.85 KB 1.5 KB 1.5 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.48 KB 10.48 KB 3.58 KB 3.58 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.1% 1.1 KB 1.1 KB 667 B 668 B NODE_PROD

Generated by 🚫 dangerJS

Copy link
Contributor

@necolas necolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@trueadm trueadm merged commit 67e3f3f into facebook:master Jul 8, 2019
@trueadm trueadm deleted the refine-event-target-types branch July 8, 2019 13:36
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants