We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97ff445 commit 4a97fc9Copy full SHA for 4a97fc9
perfTest/run.js
@@ -7,11 +7,13 @@ const JOB_COUNT = 200000;
7
const STUCK_JOB_COUNT = 0;
8
const PARALLELISM = 4;
9
10
+const NANOSECONDS_TO_MILLISECONDS = 1e-6;
11
+
12
const time = async (cb) => {
- const start = process.hrtime();
13
+ const start = process.hrtime.bigint();
14
await cb();
- const diff = process.hrtime(start);
- const dur = diff[0] * 1e3 + diff[1] * 1e-6;
15
+ const diff = process.hrtime.bigint() - start;
16
+ const dur = Number(diff) * NANOSECONDS_TO_MILLISECONDS;
17
console.log(`... it took ${dur.toFixed(0)}ms`);
18
return dur;
19
};
0 commit comments