Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark for tseep and fix arm64 install issue. #264

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"event-emitter": "latest",
"eventemitter2": "latest",
"eventemitter3": "0.1.6",
"fastemitter": "latest"
"fastemitter": "latest",
"browserify-events": "npm:[email protected]",
"tseep": "latest"
}
}
10 changes: 10 additions & 0 deletions benchmarks/run/add-remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2
, CE = require('contra/emitter')
, EE = require('event-emitter')
, FE = require('fastemitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

function handle() {
Expand All @@ -21,6 +23,8 @@ var ee1 = new EventEmitter1()
, master = new Master()
, drip = new Drip()
, fe = new FE()
, be = new BrowserifyEmitter()
, te = new Tseep()
, ce = CE()
, ee = EE();

Expand All @@ -44,6 +48,12 @@ var ee1 = new EventEmitter1()
}).add('fastemitter', function() {
fe.on('foo', handle);
fe.removeListener('foo', handle);
}).add('browserify-events', function() {
be.on('foo', handle);
be.removeListener('foo', handle);
}).add('tseep', function() {
te.on('foo', handle);
te.removeListener('foo', handle);
}).add('event-emitter', function() {
ee.on('foo', handle);
ee.off('foo', handle);
Expand Down
16 changes: 16 additions & 0 deletions benchmarks/run/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2
, CE = require('contra/emitter')
, EE = require('event-emitter')
, FE = require('fastemitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

var ctx = { foo: 'bar' };
Expand All @@ -23,6 +25,8 @@ var ee1 = new EventEmitter1()
, master = new Master()
, drip = new Drip()
, fe = new FE()
, be = new BrowserifyEmitter()
, te = new Tseep()
, ce = CE()
, ee = EE();

Expand All @@ -33,6 +37,8 @@ drip.on('foo', handle.bind(ctx));
master.on('foo', handle, ctx);
ee.on('foo', handle.bind(ctx));
fe.on('foo', handle.bind(ctx));
be.on('foo', handle.bind(ctx));
te.on('foo', handle.bind(ctx));
ce.on('foo', handle.bind(ctx));

(
Expand Down Expand Up @@ -67,6 +73,16 @@ ce.on('foo', handle.bind(ctx));
fe.emit('foo', 'bar');
fe.emit('foo', 'bar', 'baz');
fe.emit('foo', 'bar', 'baz', 'boom');
}).add('browserify-events', function() {
be.emit('foo');
be.emit('foo', 'bar');
be.emit('foo', 'bar', 'baz');
be.emit('foo', 'bar', 'baz', 'boom');
}).add('tseep', function() {
te.emit('foo');
te.emit('foo', 'bar');
te.emit('foo', 'bar', 'baz');
te.emit('foo', 'bar', 'baz', 'boom');
}).add('event-emitter', function() {
ee.emit('foo');
ee.emit('foo', 'bar');
Expand Down
16 changes: 16 additions & 0 deletions benchmarks/run/emit-multiple-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2
, CE = require('contra/emitter')
, EE = require('event-emitter')
, FE = require('fastemitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

function foo() {
Expand All @@ -33,12 +35,16 @@ var ee1 = new EventEmitter1()
, ee3 = new EventEmitter3()
, master = new Master()
, fe = new FE()
, be = new BrowserifyEmitter()
, te = new Tseep()
, ce = CE()
, ee = EE();

ce.on('foo', foo).on('foo', bar).on('foo', baz);
ee.on('foo', foo).on('foo', bar).on('foo', baz);
fe.on('foo', foo).on('foo', bar).on('foo', baz);
be.on('foo', foo).on('foo', bar).on('foo', baz);
te.on('foo', foo).on('foo', bar).on('foo', baz);
ee3.on('foo', foo).on('foo', bar).on('foo', baz);
ee2.on('foo', foo).on('foo', bar).on('foo', baz);
ee1.on('foo', foo).on('foo', bar).on('foo', baz);
Expand Down Expand Up @@ -76,6 +82,16 @@ master.on('foo', foo).on('foo', bar).on('foo', baz);
fe.emit('foo', 'bar');
fe.emit('foo', 'bar', 'baz');
fe.emit('foo', 'bar', 'baz', 'boom');
}).add('browserify-events', function() {
be.emit('foo');
be.emit('foo', 'bar');
be.emit('foo', 'bar', 'baz');
be.emit('foo', 'bar', 'baz', 'boom');
}).add('tseep', function() {
te.emit('foo');
te.emit('foo', 'bar');
te.emit('foo', 'bar', 'baz');
te.emit('foo', 'bar', 'baz', 'boom');
}).add('event-emitter', function() {
ee.emit('foo');
ee.emit('foo', 'bar');
Expand Down
16 changes: 16 additions & 0 deletions benchmarks/run/emit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2
, CE = require('contra/emitter')
, EE = require('event-emitter')
, FE = require('fastemitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

function handle() {
Expand All @@ -21,11 +23,15 @@ var ee1 = new EventEmitter1()
, master = new Master()
, drip = new Drip()
, fe = new FE()
, be = new BrowserifyEmitter()
, te = new Tseep()
, ce = CE()
, ee = EE();

ee.on('foo', handle);
fe.on('foo', handle);
be.on('foo', handle);
te.on('foo', handle);
ee3.on('foo', handle);
ee2.on('foo', handle);
ee1.on('foo', handle);
Expand Down Expand Up @@ -65,6 +71,16 @@ ce.on('foo', handle);
fe.emit('foo', 'bar');
fe.emit('foo', 'bar', 'baz');
fe.emit('foo', 'bar', 'baz', 'boom');
}).add('browserify-events', function() {
be.emit('foo');
be.emit('foo', 'bar');
be.emit('foo', 'bar', 'baz');
be.emit('foo', 'bar', 'baz', 'boom');
}).add('tseep', function() {
te.emit('foo');
te.emit('foo', 'bar');
te.emit('foo', 'bar', 'baz');
te.emit('foo', 'bar', 'baz', 'boom');
}).add('event-emitter', function() {
ee.emit('foo');
ee.emit('foo', 'bar');
Expand Down
14 changes: 14 additions & 0 deletions benchmarks/run/hundreds.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2
, CE = require('contra/emitter')
, EE = require('event-emitter')
, FE = require('fastemitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

function foo() {
Expand All @@ -23,6 +25,8 @@ var ee1 = new EventEmitter1()
, master = new Master()
, drip = new Drip()
, fe = new FE()
, be = new BrowserifyEmitter()
, te = new Tseep()
, ce = CE()
, ee = EE()
, j, i;
Expand All @@ -32,6 +36,8 @@ for (i = 0; i < 10; i++) {
ce.on('event:' + i, foo);
ee.on('event:' + i, foo);
fe.on('event:' + i, foo);
be.on('event:' + i, foo);
te.on('event:' + i, foo);
ee1.on('event:' + i, foo);
ee2.on('event:' + i, foo);
ee3.on('event:' + i, foo);
Expand Down Expand Up @@ -66,6 +72,14 @@ for (i = 0; i < 10; i++) {
for (i = 0; i < 10; i++) {
fe.emit('event:' + i);
}
}).add('browserify-events', function() {
for (i = 0; i < 10; i++) {
be.emit('event:' + i);
}
}).add('tseep', function() {
for (i = 0; i < 10; i++) {
te.emit('event:' + i);
}
}).add('event-emitter', function() {
for (i = 0; i < 10; i++) {
ee.emit('event:' + i);
Expand Down
6 changes: 6 additions & 0 deletions benchmarks/run/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2
, CE = require('contra/emitter')
, EE = require('event-emitter')
, FE = require('fastemitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

//
Expand All @@ -31,6 +33,10 @@ var emitter;
emitter = new Drip();
}).add('fastemitter', function() {
emitter = new FE();
}).add('browserify-events', function() {
emitter = new BrowserifyEmitter();
}).add('tseep', function() {
emitter = new Tseep();
}).add('event-emitter', function() {
emitter = EE();
}).add('contra/emitter', function() {
Expand Down
14 changes: 13 additions & 1 deletion benchmarks/run/listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var benchmark = require('benchmark');
var EventEmitter1 = require('events').EventEmitter
, EventEmitter3 = require('eventemitter3')
, FE = require('fastemitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

var MAX_LISTENERS = Math.pow(2, 32) - 1;
Expand All @@ -16,16 +18,22 @@ function handle() {
var ee1 = new EventEmitter1()
, ee3 = new EventEmitter3()
, master = new Master()
, fe = new FE();
, fe = new FE()
, be = new BrowserifyEmitter()
, te = new Tseep();

ee1.setMaxListeners(MAX_LISTENERS);
fe.setMaxListeners(MAX_LISTENERS);
be.setMaxListeners(MAX_LISTENERS);
te.setMaxListeners(MAX_LISTENERS);

for (var i = 0; i < 25; i++) {
ee1.on('event', handle);
ee3.on('event', handle);
master.on('event', handle);
fe.on('event', handle);
be.on('event', handle);
te.on('event', handle);
}

//
Expand All @@ -45,6 +53,10 @@ for (var i = 0; i < 25; i++) {
master.listeners('event');
}).add('fastemitter', function() {
fe.listeners('event');
}).add('browserify-events', function() {
be.listeners('event');
}).add('tseep', function() {
te.listeners('event');
}).on('cycle', function cycle(e) {
console.log(e.target.toString());
}).on('complete', function completed() {
Expand Down
8 changes: 8 additions & 0 deletions benchmarks/run/once.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2
, CE = require('contra/emitter')
, EE = require('event-emitter')
, FE = require('fastemitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

function handle() {
Expand All @@ -21,6 +23,8 @@ var ee1 = new EventEmitter1()
, master = new Master()
, drip = new Drip()
, fe = new FE()
, be = new BrowserifyEmitter()
, te = new Tseep()
, ce = CE()
, ee = EE();

Expand All @@ -38,6 +42,10 @@ var ee1 = new EventEmitter1()
drip.once('foo', handle).emit('foo');
}).add('fastemitter', function() {
fe.once('foo', handle).emit('foo');
}).add('browserify-events', function() {
be.once('foo', handle).emit('foo');
}).add('tseep', function() {
te.once('foo', handle).emit('foo');
}).add('event-emitter', function() {
ee.once('foo', handle).emit('foo');
}).add('contra/emitter', function() {
Expand Down
16 changes: 15 additions & 1 deletion benchmarks/run/remove-emit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2
, Drip = require('drip').EventEmitter
, CE = require('contra/emitter')
, EE = require('event-emitter')
, BrowserifyEmitter = require('browserify-events')
, Tseep = require('tseep').EventEmitter
, Master = require('../../');

function handle() {
Expand All @@ -19,10 +21,12 @@ var ee1 = new EventEmitter1()
, ee3 = new EventEmitter3()
, master = new Master()
, drip = new Drip()
, be = new BrowserifyEmitter()
, te = new Tseep()
, ce = CE()
, ee = EE();

[ee1, ee2, ee3, master, drip, ee, ce].forEach(function ohai(emitter) {
[ee1, ee2, ee3, master, drip, be, te, ee, ce].forEach(function ohai(emitter) {
emitter.on('foo', handle);

//
Expand Down Expand Up @@ -66,6 +70,16 @@ var ee1 = new EventEmitter1()
drip.emit('foo', 'bar');
drip.emit('foo', 'bar', 'baz');
drip.emit('foo', 'bar', 'baz', 'boom');
}).add('browserify-events', function() {
be.emit('foo');
be.emit('foo', 'bar');
be.emit('foo', 'bar', 'baz');
be.emit('foo', 'bar', 'baz', 'boom');
}).add('tseep', function() {
te.emit('foo');
te.emit('foo', 'bar');
te.emit('foo', 'bar', 'baz');
te.emit('foo', 'bar', 'baz', 'boom');
}).add('event-emitter', function() {
ee.emit('foo');
ee.emit('foo', 'bar');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@
"rimraf": "^4.1.2",
"rollup": "^3.4.0",
"sauce-browsers": "^3.0.0",
"sauce-test": "^1.3.3"
"sauce-test": "git+https://github.com/Romick2005/sauce-test.git"
}
}