2016-02-20 09:03:16 +08:00
|
|
|
'use strict';
|
2015-02-06 04:26:28 +08:00
|
|
|
var common = require('../common.js');
|
|
|
|
var EventEmitter = require('events').EventEmitter;
|
|
|
|
|
2015-02-07 04:40:53 +08:00
|
|
|
var bench = common.createBenchmark(main, {n: [5e6]});
|
2015-02-06 04:26:28 +08:00
|
|
|
|
|
|
|
function main(conf) {
|
|
|
|
var n = conf.n | 0;
|
|
|
|
|
|
|
|
var ee = new EventEmitter();
|
|
|
|
|
|
|
|
for (var k = 0; k < 10; k += 1)
|
|
|
|
ee.on('dummy', function() {});
|
|
|
|
|
|
|
|
bench.start();
|
|
|
|
for (var i = 0; i < n; i += 1) {
|
2016-02-25 14:30:10 +08:00
|
|
|
ee.listeners('dummy');
|
2015-02-06 04:26:28 +08:00
|
|
|
}
|
|
|
|
bench.end(n);
|
|
|
|
}
|