jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<script src="https://unpkg.com/mitt/dist/mitt.umd.js"></script>
// API web
/**
* Trigger custom event
* @param {string} eventName Custom event name
* @param {any} data Data
*/
function triggerCustomEvent(eventName, data) {
let event = null;
if (window.CustomEvent && typeof window.CustomEvent === 'function') {
event = new CustomEvent(eventName, { detail: data });
} else {
event = document.createEvent('CustomEvent');
event.initCustomEvent(eventName, true, true, data);
}
document.body.dispatchEvent(event);
}
document.body.addEventListener(
'body-foo',
e => console.log(e.detail)
);
// MITT
const emitter = mitt()
emitter.on(
'mitt-foo',
e => console.log('foo', e)
);
Ready to run.
Test | Ops/sec | |
---|---|---|
CustomEvent |
| ready |
Mitt |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.