Skip to content

Commit 4a97fc9

Browse files
committed
Use newer methods
1 parent 97ff445 commit 4a97fc9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

perfTest/run.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ const JOB_COUNT = 200000;
77
const STUCK_JOB_COUNT = 0;
88
const PARALLELISM = 4;
99

10+
const NANOSECONDS_TO_MILLISECONDS = 1e-6;
11+
1012
const time = async (cb) => {
11-
const start = process.hrtime();
13+
const start = process.hrtime.bigint();
1214
await cb();
13-
const diff = process.hrtime(start);
14-
const dur = diff[0] * 1e3 + diff[1] * 1e-6;
15+
const diff = process.hrtime.bigint() - start;
16+
const dur = Number(diff) * NANOSECONDS_TO_MILLISECONDS;
1517
console.log(`... it took ${dur.toFixed(0)}ms`);
1618
return dur;
1719
};

0 commit comments

Comments
 (0)