diff --git a/.jules/bolt.md b/.jules/bolt.md index b08b203a..bcc88a91 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-07-12 - 핫루프 내 날짜 포맷 최적화 (String.padStart 회피) +**Learning:** `String.prototype.padStart()` 메서드는 편리하지만 핫루프(예: 날짜 포맷팅) 내에서 호출될 때 불필요한 문자열 객체 할당 오버헤드를 발생시켜 성능을 저하시킵니다. 특히 대량의 WBS 데이터를 렌더링하거나 처리할 때 이러한 오버헤드는 누적됩니다. +**Action:** 성능에 민감한 핫루프 내에서 단순한 패딩 처리가 필요한 경우, 항상 인라인 삼항 연산자 기반의 문자열 연결(예: `m < 10 ? '0' + m : m`)을 사용하여 할당 비용과 함수 호출 오버헤드를 줄이세요. diff --git a/CHANGELOG.md b/CHANGELOG.md index e434fa01..e96b8bec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,6 +91,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 script, and requirements copies. - Documented Kubernetes/IaC as follow-up work rather than a current blocker for this static app. +- ⚡ Bolt: 날짜 포맷팅 함수(`formatDateInput`, `formatLocalDateInput`, `formatCompactDate`)에서 `String.prototype.padStart()` 호출을 인라인 삼항 연산자로 대체하여 메모리 할당을 최적화하고 핫루프 성능을 개선했습니다. ## [1.0.0] - 2026-04-20 diff --git a/app.js b/app.js index a04aae71..ee388e33 100644 --- a/app.js +++ b/app.js @@ -2684,20 +2684,28 @@ function clamp(value, min, max) { function formatDateInput(date) { const year = date.getUTCFullYear(); - const month = String(date.getUTCMonth() + 1).padStart(2, '0'); - const day = String(date.getUTCDate()).padStart(2, '0'); + const m = date.getUTCMonth() + 1; + const d = date.getUTCDate(); + // ⚡ Bolt: Inline ternary avoids String.padStart() allocation overhead in hot loops. + const month = m < 10 ? '0' + m : m; + const day = d < 10 ? '0' + d : d; return `${year}-${month}-${day}`; } function formatLocalDateInput(date) { const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); + const m = date.getMonth() + 1; + const d = date.getDate(); + // ⚡ Bolt: Inline ternary string concatenation is faster than String.padStart(). + const month = m < 10 ? '0' + m : m; + const day = d < 10 ? '0' + d : d; return `${year}-${month}-${day}`; } function formatCompactDate(date) { - return `${date.getFullYear()}${String(date.getMonth() + 1).padStart(2, '0')}${String(date.getDate()).padStart(2, '0')}`; + const m = date.getMonth() + 1; + const d = date.getDate(); + return `${date.getFullYear()}${m < 10 ? '0' + m : m}${d < 10 ? '0' + d : d}`; } function formatPercent(value, digits) { diff --git a/index.html b/index.html index d24b2a88..879ad03b 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,8 @@ ScopeWeave Planner + +