mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: fix node:bench test timing
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65606 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
This commit is contained in:
1 parent
536ae0e24b
commit
5a38e6b115
18 files changed
+18
-54
No files matched your search
Vendored
+1
-3
@@ -6,7 +6,5 @@ bench('alpha', {
|
||||
params: { file: 'a', pid: process.pid },
|
||||
samples: 1,
|
||||
}, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -12,7 +12,5 @@ if (mode === 'late') {
|
||||
}
|
||||
|
||||
bench('abrupt exit', { samples: 1 }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
Vendored
+1
-3
@@ -4,7 +4,5 @@ bench('beta', {
|
||||
params: { file: 'b', pid: process.pid },
|
||||
samples: 1,
|
||||
}, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -3,8 +3,6 @@
|
||||
const { bench } = require('node:bench');
|
||||
|
||||
bench('sets exit code', { samples: 1 }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
process.exitCode = 2;
|
||||
});
|
||||
+1
-3
@@ -6,7 +6,5 @@ bench('imported', {
|
||||
samples: 1,
|
||||
params: { imported: globalThis.benchImport },
|
||||
}, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -9,7 +9,5 @@ bench('inspector option', {
|
||||
params: { inspectPort },
|
||||
samples: 1,
|
||||
}, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
Vendored
+1
-3
@@ -5,7 +5,5 @@ const { bench } = require('node:bench');
|
||||
process.send?.({ type: 'user-message' });
|
||||
|
||||
bench('user IPC', { samples: 1 }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -4,7 +4,5 @@ const { bench } = require('node:bench');
|
||||
|
||||
bench('many records', { samples: 30 }, (b) => {
|
||||
process.stdout.write(`${b.index}\n`);
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -9,9 +9,7 @@ bench('selected', {
|
||||
warmup: 8,
|
||||
}, (b) => {
|
||||
invocations++;
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(invocations);
|
||||
b.record({ duration_ns: 1n, operations: invocations });
|
||||
});
|
||||
|
||||
bench('filtered out', { samples: 1 }, () => {
|
||||
|
||||
+1
-3
@@ -6,7 +6,5 @@ process.stdout.write('benchmark stdout\n');
|
||||
process.stderr.write('benchmark stderr\n');
|
||||
|
||||
bench('output', { samples: 1 }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -10,7 +10,5 @@ bench('preloaded', {
|
||||
params: { preloaded: true },
|
||||
samples: 1,
|
||||
}, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
Vendored
+1
-3
@@ -3,9 +3,7 @@
|
||||
const { bench, run } = require('node:bench');
|
||||
|
||||
bench('declared before run', { samples: 1 }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
|
||||
run();
|
||||
+1
-3
@@ -11,7 +11,5 @@ if (process.env.NODE_BENCH_SEND_ERROR === 'callback') {
|
||||
const { bench } = require('node:bench');
|
||||
|
||||
bench('send error', { samples: 1 }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -4,9 +4,7 @@ const { bench, suite } = require('node:bench');
|
||||
|
||||
function register(name) {
|
||||
bench(name, { params: { size: 1 } }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -3,7 +3,5 @@
|
||||
const { bench } = require('node:bench');
|
||||
|
||||
bench('tools/no-params.js', (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -3,7 +3,5 @@
|
||||
const { bench } = require('node:bench');
|
||||
|
||||
bench('tools/reserved.js', { params: { rate: 'parameter' } }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
+1
-3
@@ -7,7 +7,5 @@ assert.strictEqual(Error.stackTraceLimit, 17);
|
||||
assert(process.execArgv.includes('--random-seed=17'));
|
||||
|
||||
bench('V8 option', { samples: 1 }, (b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
});
|
||||
@@ -14,9 +14,7 @@ const child = spawnSync(process.execPath, [
|
||||
assert.strictEqual(child.status, 1);
|
||||
|
||||
const completion = bench('automatic execution', common.mustCall((b) => {
|
||||
b.start();
|
||||
process.hrtime.bigint();
|
||||
b.end(1);
|
||||
b.record({ duration_ns: 1n, operations: 1 });
|
||||
}, 30));
|
||||
|
||||
completion.then(common.mustCall((result) => {
|
||||
|
||||
Reference in new issue
Block a user