You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently place DOM event handlers on the elements' on#{whatever} properties. I've heard that this is considered a poor practice, performance-wise. I haven't found any hard data to back that up and my own performance tests show no meaningful difference.
I tested it by adding dom-delegator and updating on#{event_name} in the properties hash translation to become ev-#{event_name}. The app worked exactly as it had, and event handler usage became constant (instead of increasing until the previous handlers were GCed as with setting onclick), but CPU time and memory usage did not change by any meaningful amount across several test runs both before and after.
What I'm wondering is, is there any real-world benchmarks for recent browsers showing that using event delegation is truly more efficient?
The text was updated successfully, but these errors were encountered:
We currently place DOM event handlers on the elements'
on#{whatever}
properties. I've heard that this is considered a poor practice, performance-wise. I haven't found any hard data to back that up and my own performance tests show no meaningful difference.I tested it by adding
dom-delegator
and updatingon#{event_name}
in the properties hash translation to becomeev-#{event_name}
. The app worked exactly as it had, and event handler usage became constant (instead of increasing until the previous handlers were GCed as with settingonclick
), but CPU time and memory usage did not change by any meaningful amount across several test runs both before and after.What I'm wondering is, is there any real-world benchmarks for recent browsers showing that using event delegation is truly more efficient?
The text was updated successfully, but these errors were encountered: