summaryrefslogtreecommitdiff
path: root/cli/rt/11_timers.js
diff options
context:
space:
mode:
authorSteven Guerrero <stephenguerrero43@gmail.com>2020-12-07 08:27:25 -0500
committerGitHub <noreply@github.com>2020-12-07 08:27:25 -0500
commit43a35b005f9f4631dd97a9db0f41ad76eaed941e (patch)
tree50f65c3c5a2260ec3455c79c4ea8185ffad67c07 /cli/rt/11_timers.js
parentb77d6cb29e4437f4783368aaa3b1d5c972470ad0 (diff)
perf: use minimal op with performance.now() (#8619)
Diffstat (limited to 'cli/rt/11_timers.js')
-rw-r--r--cli/rt/11_timers.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/rt/11_timers.js b/cli/rt/11_timers.js
index c762c59d8..5a59844a3 100644
--- a/cli/rt/11_timers.js
+++ b/cli/rt/11_timers.js
@@ -3,6 +3,7 @@
((window) => {
const assert = window.__bootstrap.util.assert;
const core = window.Deno.core;
+ const { sendSync } = window.__bootstrap.dispatchMinimal;
function opStopGlobalTimer() {
core.jsonOpSync("op_global_timer_stop");
@@ -16,8 +17,10 @@
await core.jsonOpAsync("op_global_timer");
}
+ const nowBytes = new Uint8Array(8);
function opNow() {
- return core.jsonOpSync("op_now");
+ sendSync("op_now", 0, nowBytes);
+ return new DataView(nowBytes.buffer).getFloat64();
}
function sleepSync(millis = 0) {