Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 - Avoid String.padStart() overhead in date formatters
**Learning:** Using `String().padStart()` inside hot loops (like O(N) rendering functions where date formatting is frequently used) incurs unnecessary string allocations and JS-to-C++ overhead.
**Action:** Prefer using inline ternary string concatenation (`val < 10 ? '0' + val : val`) for simple zero-padding logic to optimize performance.
21 changes: 16 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2684,20 +2684,31 @@ 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');
// ⚡ Optimization: Use inline ternary instead of String.padStart() to avoid string allocations and JS-to-C++ overhead
const m = date.getUTCMonth() + 1;
const d = date.getUTCDate();
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');
// ⚡ Optimization: Use inline ternary instead of String.padStart() to avoid string allocations and JS-to-C++ overhead
const m = date.getMonth() + 1;
const d = date.getDate();
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')}`;
// ⚡ Optimization: Use inline ternary instead of String.padStart() to avoid string allocations and JS-to-C++ overhead
const m = date.getMonth() + 1;
const d = date.getDate();
const month = m < 10 ? '0' + m : m;
const day = d < 10 ? '0' + d : d;
return `${date.getFullYear()}${month}${day}`;
}

function formatPercent(value, digits) {
Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'none'; form-action 'self';" />
<title>ScopeWeave Planner</title>
<link rel="preload" href="styles.css" as="style" />
<link rel="modulepreload" href="cloud-sync.js" />
<link rel="modulepreload" href="analytics.js" />
<link rel="modulepreload" href="app.js" />
<link rel="stylesheet" href="styles.css" />
</head>
Expand Down
Loading