diff --git a/src/http/core.ts b/src/http/core.ts index 37528f1..cace5ff 100644 --- a/src/http/core.ts +++ b/src/http/core.ts @@ -51,13 +51,19 @@ export function correlateRequest(headers: Record toString(36) from a pool 114 ns + // Math.random() x2 -> base36 265 ns 3.5x SLOWER; string work dominates + // getRandomValues per call, unbatched 472 ns + // + // The only cross-runtime win is 26 ns, against ~10.19 us for a real socketed request. A hand- + // rolled entropy pool is not worth 0.26%. A lazy getter is separately useless: the adapters and + // the payload builders both spread this object, and the first spread materialises it. return { requestId: incoming || crypto.randomUUID(), traceId: traceId || undefined }; }