diff options
| author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-09-07 16:21:47 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-07 16:21:47 +0530 |
| commit | 027d4d433dce32a3b715184b54e7fe6403dedec2 (patch) | |
| tree | dfd70be0537dd8defce5ef14eacfa57be222746d /ext/web/02_timers.js | |
| parent | d57f9d560d7b675bda3cf3ba0ac69201b73467b3 (diff) | |
perf(ops): inline &[u8] arguments and enable fast API (#15731)
Diffstat (limited to 'ext/web/02_timers.js')
| -rw-r--r-- | ext/web/02_timers.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ext/web/02_timers.js b/ext/web/02_timers.js index 6cbc706e6..5d7ee49e0 100644 --- a/ext/web/02_timers.js +++ b/ext/web/02_timers.js @@ -13,6 +13,7 @@ MapPrototypeGet, MapPrototypeHas, MapPrototypeSet, + Uint8Array, Uint32Array, // deno-lint-ignore camelcase NumberPOSITIVE_INFINITY, @@ -27,13 +28,10 @@ const { reportException } = window.__bootstrap.event; const { assert } = window.__bootstrap.infra; - let hr; + const hrU8 = new Uint8Array(8); + const hr = new Uint32Array(hrU8.buffer); function opNow() { - if (!hr) { - hr = new Uint32Array(2); - ops.op_now_set_buf(hr); - } - ops.op_now.fast(); + ops.op_now.fast(hrU8); return (hr[0] * 1000 + hr[1] / 1e6); } |
