Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
AddEventListener vs direct v2
(version: 1)
Comparing performance of:
Add vs Direct
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
Add
const element = document.createElement('div'); element.addEventListener('click', () => console.log(''));
Direct
const element = document.createElement('div'); element.onclick = () => console.log('');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Add
Direct
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0
Browser/OS:
Firefox 135 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Add
1131598.5 Ops/sec
Direct
749353.4 Ops/sec
Related benchmarks:
AddEventListener
AddEventListener
Event listener anonymous function vs named inline function vs external function
Event listener anonymous function vs named inline function vs external function
addEventListener vs jQuery
Event Js
addEventListener() vs jQuery.on() with click
Cost of adding and removing events
AddEventListener vs direct
Comments
Confirm delete:
Do you really want to delete benchmark?