chrisdavies / eev

A tiny, fast, zero-dependency event emitter
522 stars 32 forks source link

Better publicise eev's performance against other libraries and in browsers other than Chrome #14

Closed stowball closed 5 years ago

stowball commented 5 years ago

As few use jQuery anymore, I created a new test case comparing eev to using Vue as an eventBus. In it, you'll notice that it's considerably faster. I also tried it in Firefox, Safari and Edge (incorrectly reported as Chrome 51.0.2704), and eev's performance in these browsers is orders of magnitudes greater than against both Vue and jQuery.

Then, I decided to compare eev to the much more popular, Mitt and the results were, surprisingly to me, very similar to the massive performance improvements to the other libraries.

I really think you should publicise this.

chrisdavies commented 5 years ago

Hey! Very cool. Thanks for doing this.

Eev makes a trade-off. It optimizes for event-handling speed at the expense of somewhat more complex register / unregister logic. So, registering / unregistering a handler will (probably) be more expensive in Eev than in the other frameworks. I think this is a reasonable trade-off, because most of my apps emit and handle events more frequently than they register / unregister handlers. But in an app where handlers are being registered / unregistered frequently, Eev will probably cause compiler churn and may be more expensive than other options.

I don't know any of that for a fact, as I haven't bothered to test it. Do you think it's worth testing that, too?

chrisdavies commented 5 years ago

I updated the perf link to use your jQuery and Vue one. I'm open to suggestions about how better to highlight this aspect of Eev, but for now, that'll do. Thanks again!