diff options
author | Garet Halliday <me@garet.holiday> | 2022-10-13 19:35:18 -0500 |
---|---|---|
committer | Michael Knyszek <mknyszek@google.com> | 2023-05-22 17:47:47 +0000 |
commit | 1cfacfbe8ae7ed12eb798c84b53e1ebd0e3ed0b0 (patch) | |
tree | 8c97c61c7efbe97fc80ff2f30765d48cacaa5340 /misc | |
parent | 1dad7ef572d725ac1c4349d3dbb15bdc9e30618d (diff) | |
download | go-1cfacfbe8ae7ed12eb798c84b53e1ebd0e3ed0b0.tar.gz go-1cfacfbe8ae7ed12eb798c84b53e1ebd0e3ed0b0.zip |
wasm: remove redundant calls to setTimeout and clearTimeout
The existing implementation clears and recreates Javascript
timeouts when Go is called from js, leading to excessive
load on the js scheduler. Instead, we should remove redundant
calls to clearTimeout and refrain from creating new timeouts
if the previous event's timestamp is within 1 millisecond of
our target (the js scheduler's max precision)
Fixes #56100
Change-Id: I42bbed4c2f1fa6579c1f3aa519b6ed8fc003a20c
Reviewed-on: https://go-review.googlesource.com/c/go/+/442995
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/wasm/wasm_exec.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/wasm/wasm_exec.js b/misc/wasm/wasm_exec.js index 7f72bee005..bc6f210242 100644 --- a/misc/wasm/wasm_exec.js +++ b/misc/wasm/wasm_exec.js @@ -276,7 +276,7 @@ this._resume(); } }, - getInt64(sp + 8) + 1, // setTimeout has been seen to fire up to 1 millisecond early + getInt64(sp + 8), )); this.mem.setInt32(sp + 16, id, true); }, |