From: Johan Brandhorst-Satzkorn Date: Sat, 28 Jan 2023 06:48:57 +0000 (-0800) Subject: misc/wasm: use NodeJS performance library X-Git-Tag: go1.21rc1~1732 X-Git-Url: http://www.git.cypherpunks.ru/?a=commitdiff_plain;h=6ab721dfd6bda7ec21e923c76e71abc1005e8d29;p=gostls13.git 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 Reviewed-by: Bryan Mills Run-TryBot: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov Reviewed-by: Evan Phoenix Reviewed-by: Dmitri Shuralyov --- 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 = {