Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Custom Event vs Callback speed test
(version: 1)
Comparing performance of:
Custom Event vs Callback
Created:
11 months ago
by:
Guest
Jump to the latest result
Tests:
Custom Event
let i = 1001; function cb() { console.log('hi') } document.addEventListener('custom:test', cb); while (--i) { window.dispatchEvent(new CustomEvent('custom:test')); }
Callback
function cb() { console.log('hi') } let i = 1001; while (--i) { cb(); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Custom Event
Callback
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
11 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0
Browser/OS:
Chrome 136 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Custom Event
2990.5 Ops/sec
Callback
265.5 Ops/sec
Related benchmarks:
Native Event listener vs custom EventTarget vs fake listeners array
Custom Event vs Callback
Custom Event vs Callback 2
Custom Event vs Callback with console log
1000 x event listeners vs single event listener with array of 1000 callbacks
Custom Event vs Callback [fixed - apples to apples]
Custom Event vs Callback with console log large
Custom Event vs Callback (with actual call)
Custom Event vs Callback speed test 2
Comments
Confirm delete:
Do you really want to delete benchmark?