aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>2023-01-27 22:48:57 -0800
committerJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>2023-01-30 18:49:10 +0000
commit6ab721dfd6bda7ec21e923c76e71abc1005e8d29 (patch)
treed0b3966519ff7d7d91afb152a8e20a1a47285224 /misc
parentcb61585e870e2967d965d673c98f9d9a45b6e855 (diff)
downloadgo-6ab721dfd6bda7ec21e923c76e71abc1005e8d29.tar.gz
go-6ab721dfd6bda7ec21e923c76e71abc1005e8d29.zip
misc/wasm: use NodeJS performance library
The upgrade to NodeJS 18 introduces various library updates that mean we can no longer override the global performance package. Instead, rely on the performance library provided by the NodeJS runtime. Fixes #57516 Change-Id: Ic8ed902c696ad154f676e0b74b42efb84f02f8db Reviewed-on: https://go-review.googlesource.com/c/go/+/463234 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Evan Phoenix <evan@phx.io> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'misc')
-rw-r--r--misc/wasm/wasm_exec_node.js7
1 files changed, 1 insertions, 6 deletions
diff --git a/misc/wasm/wasm_exec_node.js b/misc/wasm/wasm_exec_node.js
index f9200ca950..90905db115 100644
--- a/misc/wasm/wasm_exec_node.js
+++ b/misc/wasm/wasm_exec_node.js
@@ -14,12 +14,7 @@ globalThis.fs = require("fs");
globalThis.TextEncoder = require("util").TextEncoder;
globalThis.TextDecoder = require("util").TextDecoder;
-globalThis.performance = {
- now() {
- const [sec, nsec] = process.hrtime();
- return sec * 1000 + nsec / 1000000;
- },
-};
+globalThis.performance ??= require("performance");
const crypto = require("crypto");
globalThis.crypto = {