perf: gather all event listeners in parallel #1667
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this was some low hanging performance fruit discussed last week, getting all the event listeners for all nodes in the page in parallel rather than waiting on each command to finish. We aren't enabling/disabling domains or listening for events, so this should be safe.
Profile for the
EventListeners
gatherer doesn't look all that different but it does save e.g. 700ms (1300 -> 600) when running on www.chromestatus.com.before:
![screen shot 2017-02-07 at 17 09 05](https://cloud.githubusercontent.com/assets/316891/22719016/459cc8cc-ed58-11e6-9a2f-0168edd3f403.png)
after:
![screen shot 2017-02-07 at 17 09 20](https://cloud.githubusercontent.com/assets/316891/22719020/49af0c68-ed58-11e6-97b1-92b03d9862c0.png)
(purple block under 11750ms is all the commands now being sent at once. Remaining scatter of blocks is now just returning messages, not interleaved returning messages and sending messages)