diff --git a/benchmark/events/ee-add-remove.js b/benchmark/events/ee-add-remove.js index 99d85367cb..1140a81649 100644 --- a/benchmark/events/ee-add-remove.js +++ b/benchmark/events/ee-add-remove.js @@ -16,10 +16,13 @@ function main(conf) { bench.start(); for (var i = 0; i < n; i += 1) { - for (k = listeners.length; --k >= 0; /* empty */) - ee.on('dummy', listeners[k]); - for (k = listeners.length; --k >= 0; /* empty */) - ee.removeListener('dummy', listeners[k]); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + for (k = listeners.length; --k >= 0; /* empty */) { + ee.on(dummy, listeners[k]); + } + for (k = listeners.length; --k >= 0; /* empty */) { + ee.removeListener(dummy, listeners[k]); + } } bench.end(n); } diff --git a/benchmark/events/ee-listener-count-on-prototype.js b/benchmark/events/ee-listener-count-on-prototype.js index dfe7e27cd0..269fd5a493 100644 --- a/benchmark/events/ee-listener-count-on-prototype.js +++ b/benchmark/events/ee-listener-count-on-prototype.js @@ -9,12 +9,15 @@ function main(conf) { var ee = new EventEmitter(); - for (var k = 0; k < 10; k += 1) - ee.on('dummy', function() {}); + for (var k = 0; k < 5; k += 1) { + ee.on('dummy0', function() {}); + ee.on('dummy1', function() {}); + } bench.start(); for (var i = 0; i < n; i += 1) { - ee.listenerCount('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.listenerCount(dummy); } bench.end(n); } diff --git a/benchmark/events/ee-listeners-many.js b/benchmark/events/ee-listeners-many.js index 063732e1fa..09e533de32 100644 --- a/benchmark/events/ee-listeners-many.js +++ b/benchmark/events/ee-listeners-many.js @@ -10,12 +10,15 @@ function main(conf) { var ee = new EventEmitter(); ee.setMaxListeners(101); - for (var k = 0; k < 100; k += 1) - ee.on('dummy', function() {}); + for (var k = 0; k < 50; k += 1) { + ee.on('dummy0', function() {}); + ee.on('dummy1', function() {}); + } bench.start(); for (var i = 0; i < n; i += 1) { - ee.listeners('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.listeners(dummy); } bench.end(n); } diff --git a/benchmark/events/ee-listeners.js b/benchmark/events/ee-listeners.js index e91ca5078f..56c0e85dad 100644 --- a/benchmark/events/ee-listeners.js +++ b/benchmark/events/ee-listeners.js @@ -9,12 +9,15 @@ function main(conf) { var ee = new EventEmitter(); - for (var k = 0; k < 10; k += 1) - ee.on('dummy', function() {}); + for (var k = 0; k < 5; k += 1) { + ee.on('dummy0', function() {}); + ee.on('dummy1', function() {}); + } bench.start(); for (var i = 0; i < n; i += 1) { - ee.listeners('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.listeners(dummy); } bench.end(n); } diff --git a/benchmark/events/ee-once.js b/benchmark/events/ee-once.js index 29ea562c40..56f7fb9e7c 100644 --- a/benchmark/events/ee-once.js +++ b/benchmark/events/ee-once.js @@ -13,8 +13,9 @@ function main(conf) { bench.start(); for (var i = 0; i < n; i += 1) { - ee.once('dummy', listener); - ee.emit('dummy'); + var dummy = (i % 2 === 0) ? 'dummy0' : 'dummy1'; + ee.once(dummy, listener); + ee.emit(dummy); } bench.end(n); }