]> Cypherpunks.ru repositories - gostls13.git/commit
wasm: remove redundant calls to setTimeout and clearTimeout
authorGaret Halliday <me@garet.holiday>
Fri, 14 Oct 2022 00:35:18 +0000 (19:35 -0500)
committerMichael Knyszek <mknyszek@google.com>
Mon, 22 May 2023 17:47:47 +0000 (17:47 +0000)
commit1cfacfbe8ae7ed12eb798c84b53e1ebd0e3ed0b0
tree8c97c61c7efbe97fc80ff2f30765d48cacaa5340
parent1dad7ef572d725ac1c4349d3dbb15bdc9e30618d
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>
misc/wasm/wasm_exec.js
src/runtime/lock_js.go
src/syscall/js/func.go