From 6ab721dfd6bda7ec21e923c76e71abc1005e8d29 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 27 Jan 2023 22:48:57 -0800 Subject: [PATCH] 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 --- misc/wasm/wasm_exec_node.js | 7 +------ 1 file changed, 1 insertion(+), 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 = { -- 2.44.0