Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Custom Event vs Callback speed test 2
(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') } window.addEventListener('custom:test', cb); while (--i) { window.dispatchEvent(new Event('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 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0
Browser/OS:
Firefox 139 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Custom Event
4.2 Ops/sec
Callback
90.4 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
Comments
Confirm delete:
Do you really want to delete benchmark?