Skip to content

Commit

Permalink
benchmark: (events) use destructuring
Browse files Browse the repository at this point in the history
PR-URL: nodejs#18250
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR authored and MayaLekova committed May 8, 2018
1 parent baca352 commit 78d4690
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 20 deletions.
4 changes: 1 addition & 3 deletions benchmark/events/ee-add-remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const events = require('events');

const bench = common.createBenchmark(main, { n: [25e4] });

function main(conf) {
const n = conf.n | 0;

function main({ n }) {
const ee = new events.EventEmitter();
const listeners = [];

Expand Down
6 changes: 1 addition & 5 deletions benchmark/events/ee-emit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ const bench = common.createBenchmark(main, {
listeners: [1, 5, 10],
});

function main(conf) {
const n = conf.n | 0;
const argc = conf.argc | 0;
const listeners = Math.max(conf.listeners | 0, 1);

function main({ n, argc, listeners }) {
const ee = new EventEmitter();

for (var k = 0; k < listeners; k += 1)
Expand Down
4 changes: 1 addition & 3 deletions benchmark/events/ee-listener-count-on-prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const EventEmitter = require('events').EventEmitter;

const bench = common.createBenchmark(main, { n: [5e7] });

function main(conf) {
const n = conf.n | 0;

function main({ n }) {
const ee = new EventEmitter();

for (var k = 0; k < 5; k += 1) {
Expand Down
4 changes: 1 addition & 3 deletions benchmark/events/ee-listeners-many.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const EventEmitter = require('events').EventEmitter;

const bench = common.createBenchmark(main, { n: [5e6] });

function main(conf) {
const n = conf.n | 0;

function main({ n }) {
const ee = new EventEmitter();
ee.setMaxListeners(101);

Expand Down
4 changes: 1 addition & 3 deletions benchmark/events/ee-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const EventEmitter = require('events').EventEmitter;

const bench = common.createBenchmark(main, { n: [5e6] });

function main(conf) {
const n = conf.n | 0;

function main({ n }) {
const ee = new EventEmitter();

for (var k = 0; k < 5; k += 1) {
Expand Down
4 changes: 1 addition & 3 deletions benchmark/events/ee-once.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const EventEmitter = require('events').EventEmitter;

const bench = common.createBenchmark(main, { n: [2e7] });

function main(conf) {
const n = conf.n | 0;

function main({ n }) {
const ee = new EventEmitter();

function listener() {}
Expand Down

0 comments on commit 78d4690

Please sign in to comment.