From 35512acca9032a028234d2e7cdde950c8485028a Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Sat, 9 Dec 2023 13:11:52 +0100 Subject: [PATCH] add time tracking --- 06/day6.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/06/day6.js b/06/day6.js index 00dd29f..1a71872 100644 --- a/06/day6.js +++ b/06/day6.js @@ -28,6 +28,7 @@ start.addEventListener("click", () => { function findPosition(line) { + console.time("day06") let i = 4; let packetStart = line.substring(0, 4); // should always contain 4 chars let messageStart = line.substring(0, 14); // should always contain 14 chars @@ -49,8 +50,9 @@ function findPosition(line) { messageStart = messageStart.substring(1, 14) + line[i]; } else { - output.innerHTML = "Found the first packet start marker at position " + packetStartI + ", the marker is " + packetStart + "
" + - "Found the first message start marker at position " + i + ", the marker is " + messageStart + "\n"; + output.innerHTML = "Found the first packet start marker at position " + packetStartI + ", the marker is " + packetStart + "
" + + "Found the first message start marker at position " + i + ", the marker is " + messageStart + "\n"; + console.timeEnd("day06") return; } }