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:
one year ago
by:
Guest
Go 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:
one year 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
Custom Event
3K/s
Callback
265/s
View exact numbers
Test name
Executions per second
✓
Custom Event
2,990 Ops/sec
Callback
265 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 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?