perf(core): use native addEventListener for faster rendering.#18107
perf(core): use native addEventListener for faster rendering.#18107mhevery wants to merge 1 commit intoangular:masterfrom
Conversation
IgorMinar
left a comment
There was a problem hiding this comment.
I'm not familiar with all the internals that might be affected by this change, but on the surface this looks right. We should however not merge this until after master is open for 5.0 changes due to the slight public api change.
There was a problem hiding this comment.
does this call into the native addEventListener? can you document that? it's not clear from this code what's going on here.
There was a problem hiding this comment.
Shouldn't the return type for runOutsideAngular be T (instead of any)?
fa2ef62 to
c64a586
Compare
771dca7 to
fcc7096
Compare
fcc7096 to
3421dca
Compare
|
@mhevery I took your PR for a test drive and here are the results I'm seeing on a sample app I'm using for Angular perf testing BeforeAfterSummary
As always there is a bit of fluctuation from one test to another so to draw definitive conclusions we should run benchmarks in the "laboratory" conditions. |
3421dca to
5e47f6e
Compare
Angular can make many assumptions about its event handlers. As a result the bookkeeping for native addEventListener is significantly cheaper than Zone's addEventLister which can't make such assumptions. This change bypasses the Zone's addEventListener if present and always uses the native addEventHandler. As a result registering event listeners is about 3 times faster.
5e47f6e to
d14d401
Compare
…r#18107) Angular can make many assumptions about its event handlers. As a result the bookkeeping for native addEventListener is significantly cheaper than Zone's addEventLister which can't make such assumptions. This change bypasses the Zone's addEventListener if present and always uses the native addEventHandler. As a result registering event listeners is about 3 times faster. PR Close angular#18107
…r#18107) Angular can make many assumptions about its event handlers. As a result the bookkeeping for native addEventListener is significantly cheaper than Zone's addEventLister which can't make such assumptions. This change bypasses the Zone's addEventListener if present and always uses the native addEventHandler. As a result registering event listeners is about 3 times faster. PR Close angular#18107
…r#18107) Angular can make many assumptions about its event handlers. As a result the bookkeeping for native addEventListener is significantly cheaper than Zone's addEventLister which can't make such assumptions. This change bypasses the Zone's addEventListener if present and always uses the native addEventHandler. As a result registering event listeners is about 3 times faster. PR Close angular#18107
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Angular can make many assumptions about its event handlers. As a result
the bookkeeping for native addEventListener is significantly cheaper
than Zone's addEventLister which can't make such assumptions.
This change bypasses the Zone's addEventListener if present and always
uses the native addEventHandler. As a result registering event listeners
is about 3 times faster.