Skip to content

Commit e25b95c

Browse files
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 golang#57516 Change-Id: Ic8ed902c696ad154f676e0b74b42efb84f02f8db Reviewed-on: https://go-review.googlesource.com/c/go/+/463234 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Evan Phoenix <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent ba1ba8a commit e25b95c

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

misc/wasm/wasm_exec_node.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ globalThis.fs = require("fs");
1414
globalThis.TextEncoder = require("util").TextEncoder;
1515
globalThis.TextDecoder = require("util").TextDecoder;
1616

17-
globalThis.performance = {
18-
now() {
19-
const [sec, nsec] = process.hrtime();
20-
return sec * 1000 + nsec / 1000000;
21-
},
22-
};
17+
globalThis.performance ??= require("performance");
2318

2419
const crypto = require("crypto");
2520
globalThis.crypto = {

0 commit comments

Comments
 (0)