Skip to content

Commit

Permalink
fix: use performance.now() for timestamping with node
Browse files Browse the repository at this point in the history
The high resolution timer brings noticiable overhead.

Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
jerome-benoit committed Nov 18, 2024
1 parent 7edf0d4 commit 0497b2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export const now = (() => {
}
},
node: () => {
const hrtimeBigint = process.hrtime.bigint.bind(process.bigint)
return () => Number(hrtimeBigint())
const now = performance.now.bind(performance)
return () => 1e6 * now()
},
deno: () => {
const now = performance.now.bind(performance)
Expand Down

0 comments on commit 0497b2c

Please sign in to comment.