Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Native Event listener vs custom EventTarget vs fake listeners array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 132
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Fake listeners array
42K/s
Custom EventTarget with callbacks array
12K/s
Native Event listener with callbacks array
11K/s
Custom EventTarget
379/s
Native Event listeners
342/s
View exact numbers
Test name
Executions per second
✓
Fake listeners array
42,331 Ops/sec
Custom EventTarget with callbacks array
11,822 Ops/sec
Native Event listener with callbacks array
11,287 Ops/sec
Custom EventTarget
379 Ops/sec
Native Event listeners
342 Ops/sec
Tests:
Native Event listeners
let i = 1001; const results = []; while (--i) { const index = i; window.addEventListener('custom:test', () => { results.push('Native Event listener ' + index); }, {once: true}); } window.dispatchEvent(new CustomEvent('custom:test', {bubbles: false}));
Native Event listener with callbacks array
let i = 1001; const callbacks = []; const results = []; while (--i) { const index = i; callbacks.push(() => { results.push('Fake listeners array ' + index); }); } window.addEventListener('custom:test', () => { results.push('Native Event listener ' + index); let i = callbacks.length; while (--i) callbacks[i](); }, {once: true}); window.dispatchEvent(new CustomEvent('custom:test', {bubbles: false}));
Custom EventTarget
let i = 1001; const target = new EventTarget(); const results = []; while (--i) { const index = i; target.addEventListener('custom:test', () => { results.push('Custom EventTarget ' + index); }, {once: true}); } target.dispatchEvent(new CustomEvent('custom:test', {bubbles: false}));
Custom EventTarget with callbacks array
let i = 1001; const callbacks = []; const target = new EventTarget(); const results = []; while (--i) { const index = i; callbacks.push(() => { results.push('Fake listeners array ' + index); }); } target.addEventListener('custom:test', () => { results.push('Native Event listener ' + index); let i = callbacks.length; while (--i) callbacks[i](); }, {once: true}); target.dispatchEvent(new CustomEvent('custom:test', {bubbles: false}));
Fake listeners array
let i = 1001; const callbacks = []; const results = []; while (--i) { const index = i; callbacks.push(() => { results.push('Fake listeners array ' + index); }); } i = callbacks.length; while (--i) callbacks[i]();