Skip to content
Discussion options

You must be logged in to vote

Hi @fatso83
Node.js doesn't currently expose a public hook or API specifically for overriding or stubbing the high-resolution time implementation in node:perf_hooks (which is what powers performance.now() and similar). The underlying timer mechanism is tied closely to the V8 engine's v8::Isolate::GetCurrentPlatform() and libuv's high-resolution clock, and there's no built-in extension point for userland libraries to inject custom behavior there.

That said, there is an open RFC for adding configurable high-resolution time sources, which would make exactly this kind of overriding possible (e.g., via a hook or factory function). You can track it here: https://github.com/nodejs/tc39-perf-rfcs…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fatso83
Comment options

Answer selected by fatso83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants