mirror of
https://github.com/denoland/deno.git
synced 2025-08-30 23:38:03 +00:00
fix: performance.timeOrigin (#26787)
`performance.timeOrigin` was being set from when JS started executing, but `op_now` measures from an `std::time::Instant` stored in `OpState`, which is created at a completely different time. This caused `performance.timeOrigin` to be very incorrect. This PR corrects the origin and also cleans up some of the timer code. Compared to `Date.now()`, `performance`'s time origin is now consistently within 5us (0.005ms) of system time. 
This commit is contained in:
parent
d4f1bd3dac
commit
73fbd61bd0
6 changed files with 73 additions and 44 deletions
|
@ -27,7 +27,6 @@ const {
|
|||
ArrayPrototypeForEach,
|
||||
ArrayPrototypeIncludes,
|
||||
ArrayPrototypeMap,
|
||||
DateNow,
|
||||
Error,
|
||||
ErrorPrototype,
|
||||
FunctionPrototypeBind,
|
||||
|
@ -642,7 +641,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
|||
|
||||
removeImportedOps();
|
||||
|
||||
performance.setTimeOrigin(DateNow());
|
||||
performance.setTimeOrigin();
|
||||
globalThis_ = globalThis;
|
||||
|
||||
// Remove bootstrapping data from the global scope
|
||||
|
@ -858,7 +857,7 @@ function bootstrapWorkerRuntime(
|
|||
7: nodeDebug,
|
||||
} = runtimeOptions;
|
||||
|
||||
performance.setTimeOrigin(DateNow());
|
||||
performance.setTimeOrigin();
|
||||
globalThis_ = globalThis;
|
||||
|
||||
// Remove bootstrapping data from the global scope
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue