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.
## 2023-10-27 - [Avoid String.padStart in Hot Loops]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: New learning entry dated 2023 amid 2026 entries

The appended entry in bolt.md is dated 2023-10-27 while every other entry is dated 2026, misordering the learnings log.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

**Learning:** `String.padStart()` introduces unnecessary string allocations and JS-to-C++ context switching overhead in tight rendering loops like date formatters.
**Action:** Prefer using inline ternary string concatenation (e.g., `m < 10 ? '0' + m : m`) instead of `String.prototype.padStart()` for dynamic string padding in hot paths to avoid JS-to-C++ overhead and improve performance.
19 changes: 12 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2682,22 +2682,27 @@ function clamp(value, min, max) {
return Math.min(max, Math.max(min, value));
}

// ⚡ Bolt: Inline ternary string concatenation avoids String.padStart() overhead in hot loops
function formatDateInput(date) {
const year = date.getUTCFullYear();
const month = String(date.getUTCMonth() + 1).padStart(2, '0');
const day = String(date.getUTCDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
const m = date.getUTCMonth() + 1;
const d = date.getUTCDate();
return `${year}-${m < 10 ? '0' + m : m}-${d < 10 ? '0' + d : d}`;
}

// ⚡ Bolt: Inline ternary string concatenation avoids String.padStart() overhead in hot loops
function formatLocalDateInput(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
const m = date.getMonth() + 1;
const d = date.getDate();
return `${year}-${m < 10 ? '0' + m : m}-${d < 10 ? '0' + d : d}`;
}

// ⚡ Bolt: Inline ternary string concatenation avoids String.padStart() overhead in hot loops
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) {
Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<title>ScopeWeave Planner</title>
<link rel="preload" href="styles.css" as="style" />
<link rel="modulepreload" href="app.js" />
<link rel="modulepreload" href="cloud-sync.js" />
<link rel="modulepreload" href="analytics.js" />
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="toast-state.css" />
</head>
Expand Down
Loading