From 7c1971d4f05401513e94d8aced6762656f5f7d7f Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Mon, 31 Aug 2026 14:11:26 +0000 Subject: [PATCH 1/8] feat: Replace Map with Float64Array for performance --- .jules/bolt.md | 3 +++ app.js | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index b08b203a..8646cad6 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -4,3 +4,6 @@ ## 2026-07-12 - Optimize renderTaskRow DOM allocations **Learning:** Caching unattached template nodes and instantiating them via `.cloneNode(false)` reduces DOM instantiation overhead in O(N) render loops significantly. **Action:** Apply this optimization to other hot-path rendering elements such as rows, cells, and stack containers. +## 2026-08-31 - [High-performance metric aggregation] +**Learning:** For high-performance O(N) loops in JavaScript, replacing `Array.prototype.reduce`/`forEach` and `Map` caching with standard `for` loops and typed arrays (`Float64Array`) eliminates JS engine callback allocation, garbage collection, and hash-lookup overhead. This allows for faster metric computations, specifically when iterating over large datasets in hot code paths. +**Action:** Use typed arrays over Maps for O(N) primitive storage caches when iteration indices map directly to indices, and use `for` loops instead of functional iteration methods for critical hot paths. diff --git a/app.js b/app.js index a04aae71..77915f9e 100644 --- a/app.js +++ b/app.js @@ -1370,21 +1370,25 @@ function validateDateRange(startLabel, startValue, endLabel, endValue, errors) { } function computeTaskMetrics() { - // ⚡ Bolt: Cache durationDays during total calculation to avoid recalculating for every task - const durationCache = new Map(); - const totalDays = state.tasks.reduce((sum, task) => { + // ⚡ Bolt: Replace Map and array methods with Float64Array and for-loops to reduce GC overhead + const durationCache = new Float64Array(state.tasks.length); + let totalDays = 0; + + for (let i = 0; i < state.tasks.length; i++) { + const task = state.tasks[i]; const duration = calculateDurationDays(task.plannedStartDate, task.plannedEndDate); - durationCache.set(task.id, duration); - return sum + duration; - }, 0); + durationCache[i] = duration; + totalDays += duration; + } const baseDate = state.baseDate; const byTask = new Map(); let totalWeightedPlannedRatio = 0; let totalWeightedActualRatio = 0; - state.tasks.forEach((task) => { - const durationDays = durationCache.get(task.id); + for (let i = 0; i < state.tasks.length; i++) { + const task = state.tasks[i]; + const durationDays = durationCache[i]; const weightRatio = totalDays > 0 ? durationDays / totalDays : 0; const plannedProgressRatio = calculatePlannedProgressRatio(baseDate, task.plannedStartDate, task.plannedEndDate, durationDays); const actualProgressRatio = (ACTUAL_PROGRESS_MAP[task.actualProgressStatus] || 0) / 100; @@ -1408,7 +1412,7 @@ function computeTaskMetrics() { plannedDateWarning, actualDateWarning }); - }); + } return { totalDays, From 61770f41ae11f405162fdb1a2fdbf284ac6cbfc0 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Mon, 31 Aug 2026 15:06:15 +0000 Subject: [PATCH 2/8] feat: Replace Map with Float64Array for performance From eaf6dd0b6e9a113e62d703395535dbb40a222ea8 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Mon, 31 Aug 2026 15:54:54 +0000 Subject: [PATCH 3/8] ci: re-kick required checks to bypass flake From 7a78581785ba202689d223d80fe76bfe45e09f62 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Mon, 31 Aug 2026 16:28:32 +0000 Subject: [PATCH 4/8] ci: re-kick required checks to bypass flake From 2cf27fc53659bdfb0281a2706e55d42fef6304bd Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Mon, 31 Aug 2026 18:08:31 +0000 Subject: [PATCH 5/8] ci: re-kick required checks to bypass flake From d3bf4bf7ed95984578bdeba5243813d8c2d696e3 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Mon, 31 Aug 2026 21:47:03 +0000 Subject: [PATCH 6/8] ci: re-kick required checks to bypass flake From ebe8ec1a65d019bd99612d9aab671b42a6ad202e Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Tue, 1 Sep 2026 02:39:56 +0000 Subject: [PATCH 7/8] ci: re-kick required checks to bypass flake From 47367adce13ef529bbdec7ea3b2e6d15b39d5cde Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Wed, 2 Sep 2026 02:03:16 +0000 Subject: [PATCH 8/8] ci: re-kick required checks to bypass flake