Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
fixup: use n instead of millions
  • Loading branch information
apapirovski committed Feb 9, 2018
commit 06724c3571be36607405605c4e61c5c71ae6dd2c
15 changes: 7 additions & 8 deletions benchmark/timers/timers-timeout-unpooled.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ const common = require('../common.js');
// then measures their execution on the next uv tick

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

function main({ millions }) {
const iterations = millions * 1e6;
function main({ n }) {
let count = 0;

// Function tracking on the hidden class in V8 can cause misleading
Expand All @@ -18,16 +17,16 @@ function main({ millions }) {

function cb() {
count++;
if (count === iterations)
bench.end(iterations / 1e6);
if (count === n)
bench.end(n);
}
function cb2() {
count++;
if (count === iterations)
bench.end(iterations / 1e6);
if (count === n)
bench.end(n);
}

for (var i = 0; i < iterations; i++) {
for (var i = 0; i < n; i++) {
// unref().ref() will cause each of these timers to
// allocate their own handle
setTimeout(i % 2 ? cb : cb2, 1).unref().ref();
Expand Down