Skip to content

[Flare] Improve runtime performance of hit target intersection#15836

Merged
trueadm merged 2 commits into
facebook:masterfrom
trueadm:event-target-refactor
Jun 7, 2019
Merged

[Flare] Improve runtime performance of hit target intersection#15836
trueadm merged 2 commits into
facebook:masterfrom
trueadm:event-target-refactor

Conversation

@trueadm
Copy link
Copy Markdown
Contributor

@trueadm trueadm commented Jun 7, 2019

During internal testing, we found the document.getElementFromPoint to be quite expensive. We can avoid using this DOM API entirely if we instead pass around the ResponderEvent object and calculate the same properties from the nativeEvent co-ords using the current event target. This also has a nice side-effect of reducing code-size slightly too.

@sizebot
Copy link
Copy Markdown

sizebot commented Jun 7, 2019

Details of bundled changes.

Comparing: def56c9...1e4afbc

react-events

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-events-hover.development.js -3.3% -3.9% 9.09 KB 8.79 KB 2.19 KB 2.11 KB UMD_DEV
react-events-drag.development.js 0.0% -0.1% 5.9 KB 5.9 KB 1.67 KB 1.67 KB UMD_DEV
react-events-hover.production.min.js -1.0% -1.8% 3.85 KB 3.81 KB 1.44 KB 1.42 KB UMD_PROD
react-events-drag.production.min.js 0.0% -0.3% 2.54 KB 2.54 KB 1.16 KB 1.16 KB UMD_PROD
react-events-focus-scope.development.js 0.0% -0.2% 4.79 KB 4.79 KB 1.45 KB 1.45 KB UMD_DEV
react-events.production.min.js 0.0% -0.5% 682 B 682 B 431 B 429 B UMD_PROD
ReactEventsPress-dev.js -1.3% -1.6% 22.41 KB 22.11 KB 5.07 KB 4.99 KB FB_WWW_DEV
react-events-focus-scope.production.min.js 0.0% -0.3% 2.01 KB 2.01 KB 1020 B 1017 B UMD_PROD
ReactEventsPress-prod.js -1.9% -1.4% 19.27 KB 18.9 KB 3.92 KB 3.87 KB FB_WWW_PROD
react-events-focus-scope.development.js 0.0% -0.1% 4.6 KB 4.6 KB 1.4 KB 1.39 KB NODE_DEV
react-events.production.min.js 0.0% -0.3% 512 B 512 B 353 B 352 B NODE_PROD
react-events-focus-scope.production.min.js 0.0% -0.3% 1.82 KB 1.82 KB 929 B 926 B NODE_PROD
react-events-focus.development.js 0.0% -0.2% 7.17 KB 7.17 KB 1.84 KB 1.84 KB UMD_DEV
react-events-scroll.development.js 0.0% -0.2% 3.93 KB 3.93 KB 1.23 KB 1.23 KB UMD_DEV
react-events-focus.production.min.js 0.0% -0.2% 3.08 KB 3.08 KB 1.19 KB 1.18 KB UMD_PROD
react-events-scroll.production.min.js 0.0% -0.2% 1.79 KB 1.79 KB 896 B 894 B UMD_PROD
react-events-focus.development.js 0.0% -0.2% 6.99 KB 6.99 KB 1.79 KB 1.78 KB NODE_DEV
react-events-scroll.development.js 0.0% -0.2% 3.74 KB 3.74 KB 1.17 KB 1.17 KB NODE_DEV
react-events-focus.production.min.js 0.0% -0.3% 2.9 KB 2.9 KB 1.11 KB 1.11 KB NODE_PROD
react-events-scroll.production.min.js 0.0% -0.5% 1.59 KB 1.59 KB 810 B 806 B NODE_PROD
react-events-hover.development.js -3.4% -3.9% 8.91 KB 8.6 KB 2.14 KB 2.06 KB NODE_DEV
react-events-hover.production.min.js -1.2% -2.6% 3.68 KB 3.64 KB 1.38 KB 1.35 KB NODE_PROD
react-events-drag.production.min.js 0.0% -0.1% 3.18 KB 3.18 KB 1.46 KB 1.46 KB NODE_PROD
react-events-press.development.js -1.3% -1.6% 21.53 KB 21.24 KB 4.94 KB 4.86 KB UMD_DEV
react-events-swipe.development.js 0.0% -0.2% 6.19 KB 6.19 KB 1.72 KB 1.72 KB UMD_DEV
react-events-press.production.min.js -0.9% -1.2% 7.86 KB 7.79 KB 2.79 KB 2.75 KB UMD_PROD
ReactEventsHover-dev.js -3.4% -3.7% 9.12 KB 8.81 KB 2.2 KB 2.11 KB FB_WWW_DEV
react-events-swipe.production.min.js 0.0% -0.2% 2.63 KB 2.63 KB 1.2 KB 1.2 KB UMD_PROD
ReactEventsHover-prod.js -2.8% -2.1% 7.99 KB 7.76 KB 1.85 KB 1.81 KB FB_WWW_PROD
react-events-press.development.js -1.3% -1.6% 21.34 KB 21.06 KB 4.89 KB 4.81 KB NODE_DEV
react-events-swipe.development.js 0.0% -0.2% 6 KB 6 KB 1.68 KB 1.67 KB NODE_DEV
react-events-press.production.min.js -0.9% -1.4% 7.68 KB 7.61 KB 2.73 KB 2.7 KB NODE_PROD
react-events-swipe.production.min.js 0.0% -0.3% 2.45 KB 2.45 KB 1.14 KB 1.14 KB NODE_PROD

Generated by 🚫 dangerJS

@trueadm trueadm merged commit 425473f into facebook:master Jun 7, 2019
@trueadm trueadm deleted the event-target-refactor branch June 7, 2019 14:57
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