From 57791de6ce6dec5e4f49d258651334d2d04a5d73 Mon Sep 17 00:00:00 2001 From: Alan Zabihi Date: Fri, 17 Apr 2026 13:48:08 +0200 Subject: [PATCH] perf: use Date.now() in enabled path Replaces Number(new Date()) with Date.now() in the enabled debug() hot path. Both expressions produce the same epoch-ms value; Date.now() returns it without allocating a Date object. --- src/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.js b/src/common.js index 141cb578..68f39bc2 100644 --- a/src/common.js +++ b/src/common.js @@ -72,7 +72,7 @@ function setup(env) { const self = debug; // Set `diff` timestamp - const curr = Number(new Date()); + const curr = Date.now(); const ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime;