Skip to content
Closed
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
8 changes: 4 additions & 4 deletions benchmark/dgram/single-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ const PORT = common.PORT;
// event loop cycles more than anything else.
const bench = common.createBenchmark(main, {
len: [1, 64, 256, 1024],
num: [100],
n: [100],
type: ['send', 'recv'],
dur: [5],
});

function main({ dur, len, num, type }) {
function main({ dur, len, num: n, type }) {
const chunk = Buffer.allocUnsafe(len);
let sent = 0;
let received = 0;
const socket = dgram.createSocket('udp4');

function onsend() {
if (sent++ % num === 0) {
if (sent++ % n === 0) {
// The setImmediate() is necessary to have event loop progress on OSes
// that only perform synchronous I/O on nonblocking UDP sockets.
setImmediate(() => {
for (let i = 0; i < num; i++) {
for (let i = 0; i < n; i++) {
socket.send(chunk, PORT, '127.0.0.1', onsend);
}
});
Expand Down
12 changes: 6 additions & 6 deletions benchmark/permission/permission-startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const bench = common.createBenchmark(main, {
],
prefixPath: ['/tmp'],
nFiles: [10, 100, 1000],
count: [30],
n: [30],
});

function spawnProcess(script, bench, state) {
const cmd = process.execPath || process.argv[0];
while (state.finished < state.count) {
while (state.finished < state.n) {
const child = spawnSync(cmd, script);
if (child.status !== 0) {
console.log('---- STDOUT ----');
Expand All @@ -39,13 +39,13 @@ function spawnProcess(script, bench, state) {
bench.start();
}

if (state.finished === state.count) {
bench.end(state.count);
if (state.finished === state.n) {
bench.end(state.n);
}
}
}

function main({ count, script, nFiles, prefixPath }) {
function main({ n, script, nFiles, prefixPath }) {
script = path.resolve(__dirname, '../../', `${script}.js`);
const optionsWithScript = [
'--permission',
Expand All @@ -54,6 +54,6 @@ function main({ count, script, nFiles, prefixPath }) {
script,
];
const warmup = 3;
const state = { count, finished: -warmup };
const state = { n, finished: -warmup };
spawnProcess(optionsWithScript, bench, state);
}
2 changes: 1 addition & 1 deletion benchmark/util/priority-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const bench = common.createBenchmark(main, {
n: [1e5],
}, { flags: ['--expose-internals'] });

function main({ n, type }) {
function main({ n }) {
const PriorityQueue = require('internal/priority_queue');
const queue = new PriorityQueue();
bench.start();
Expand Down
Loading