diff --git a/packages/cli/src/benchmarking/printer.js b/packages/cli/src/benchmarking/printer.js index 70906b9678..7d78d09307 100644 --- a/packages/cli/src/benchmarking/printer.js +++ b/packages/cli/src/benchmarking/printer.js @@ -11,8 +11,6 @@ export function printBenchResults() { } } - benchLogger.info(state); - const result = []; result.push(""); diff --git a/packages/stdlib/src/vendor/uuid.js b/packages/stdlib/src/vendor/uuid.js index 2cf9770879..89e76679cb 100644 --- a/packages/stdlib/src/vendor/uuid.js +++ b/packages/stdlib/src/vendor/uuid.js @@ -26,7 +26,8 @@ import { randomFillSync } from "crypto"; -const rnds8 = new Uint8Array(16); +const randomPool = new Uint8Array(256); // # of random values to pre-allocate +let poolPtr = randomPool.length; const byteToHex = []; for (let i = 0; i < 256; ++i) { @@ -60,11 +61,15 @@ function bytesToUuid(buf, offset) { * */ export function v4() { - const rnds = randomFillSync(rnds8); + if (poolPtr > randomPool.length - 16) { + randomFillSync(randomPool); + poolPtr = 0; + } + const buffer = randomPool.slice(poolPtr, (poolPtr += 16)); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; + buffer[6] = (buffer[6] & 0x0f) | 0x40; + buffer[8] = (buffer[8] & 0x3f) | 0x80; - return bytesToUuid(rnds); + return bytesToUuid(buffer); }