Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS Events Emitting
Comparing Various Event Emitter Options
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/131.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 131
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
EEV
5619138.0 Ops/sec
JQuery
160335.2 Ops/sec
Dom
134585.2 Ops/sec
Mitt
3787484.8 Ops/sec
HTML Preparation code:
<script> var Eev=function(){function e(e){this.head=new t,this.tail=new t(this.head),this.head.next=this.tail,this.linkConstructor=e,this.reg={}}function t(e,t,i){this.prev=e,this.next=t,this.fn=i||n}function n(){}function i(){this.events={}}var r=0;return e.prototype={insert:function(e){var n=new t(this.tail.prev,this.tail,e);return n.next.prev=n.prev.next=n,n},remove:function(e){e.prev.next=e.next,e.next.prev=e.prev}},t.prototype.run=function(e){this.fn(e),this.next&&this.next.run(e)},i.prototype={on:function(t,n){var i=this;t.split(/\W+/g).forEach(function(t){var o=i.events[t]||(i.events[t]=new e),s=n._eev||(n._eev=++r);o.reg[s]||(o.reg[s]=o.insert(n))})},off:function(e,t){var n=this;e.split(/\W+/g).forEach(function(e){var i=n.events[e],r=i.reg[t._eev];i.reg[t._eev]=void 0,i&&r&&i.remove(r)})},emit:function(e,t){var n=this.events[e];n&&n.head.run(t)}},i}();!function(e,t){var n=e.define;n&&n.amd?n([],t):"undefined"!=typeof module&&module.exports&&(module.exports=t())}(this,function(){return Eev}); //# sourceMappingURL=eev.min.js.map </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="https://unpkg.com/mitt/dist/mitt.umd.js"></script>
Script Preparation code:
var e = new Eev(); var c = 0; e.on('go', function (d) { ++c; }); e.on('go', function (d) { ++c; }); var e$ = $({}); var c = 0; e$.on('go', function (d) { ++c; }); e$.on('go', function (d) { ++c; }); var c = 0; document.addEventListener('go', function(d) { ++c; }); document.addEventListener('go', function(d) { ++c; }); var emitter = window.mitt(); var c = 0; // listen to an event emitter.on('foo', function(d){ ++c; } ); emitter.on('foo', function(d){ ++c; } );
Tests:
EEV
e.emit('go', 'hi');
JQuery
e$.trigger('go', 'hi');
Dom
document.dispatchEvent(new CustomEvent('go', { detail:'hi' }));
Mitt
emitter.emit('foo', { 'hello':'' });