Skip to content

Conversation

smagill
Copy link
Owner

@smagill smagill commented Dec 20, 2019

Mirror of facebook react#17678
The team have mentioned a bunch of times that it felt wrong that DOM Event Priority handling was all coupled with the SimpleEventPlugin, especially as might want to extend on the priorities with newer features and refactors in the future.

This PR breaks out the priority logic into a dedicated module and makes uses of Sets for faster lookups (I benchmarked before and after and Sets were consistently faster than object property lookups). The size difference should be neglible at best as all these strings should gzip nicely, but mostly it makes the logic easier to follow now, which is likely a better trade-off given we want to address codesize more aggressively in the future.

1 run
event object: 0.09ms
event sets: 0.08ms

100 runs
event object: 0.21ms
event sets: 0.19ms

1k runs
event object: 1.3ms
event sets: 1.1ms

10k runs
event object: 4.1ms
event sets: 3.7ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants