You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for your project. This library is fabulous for TypeScript as a robust strong-typed event emitter, I doesn't find any other library can do this so well.
However, I found the performance is an issue which cannot be neglected in this library. I profile some EventEmitter libraries:
constBenchmark=require('benchmark')constEETS=require('ee-ts/lib/ee').EventEmitterconstEE3=require('eventemitter3')constFE=require("@foxify/events").defaultletTMP=''functiondummyFn(x){TMP=x}classKlsOnXXX{run(){this.onHello('hello')}}classKlsEETSextendsEETS{run(){this.emit('hello','hello')}}classKlsEE3extendsEE3{run(){this.emit('hello','hello')}}classKlsFEextendsFE{run(){this.emit('hello','hello')}}constkls_onxxx=newKlsOnXXX()constkls_eets=newKlsEETS()constkls_ee3=newKlsEE3()constkls_fe=newKlsFE()kls_onxxx.onHello=function(ev){dummyFn(ev)}kls_eets.on('hello',function(ev){dummyFn(ev)})kls_ee3.on('hello',function(ev){dummyFn(ev)})kls_fe.on('hello',function(ev){dummyFn(ev)})varsuite=newBenchmark.Suitesuite.add('onXXX',function(){kls_onxxx.run()}).add('ee-ts',function(){kls_eets.run()}).add('ee3',function(){kls_ee3.run()}).add('fe',function(){kls_fe.run()}).on('cycle',function(event){console.log(String(event.target));}).on('complete',function(){console.log('Fastest is '+this.filter('fastest').map('name'));}).run({'async': false,// https://benchmarkjs.com/docs#options_async'delay': 1});
And the result is astonishing...
onXXX x 193,150,752 ops/sec ±4.00% (88 runs sampled)
ee-ts x 1,732,183 ops/sec ±3.64% (77 runs sampled)
ee3 x 52,713,790 ops/sec ±1.11% (89 runs sampled)
fe x 122,749,677 ops/sec ±0.55% (89 runs sampled)
Fastest is onXXX
The text was updated successfully, but these errors were encountered:
First, thanks for your project. This library is fabulous for TypeScript as a robust strong-typed event emitter, I doesn't find any other library can do this so well.
However, I found the performance is an issue which cannot be neglected in this library. I profile some EventEmitter libraries:
And the result is astonishing...
The text was updated successfully, but these errors were encountered: