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-24 - Performance penalty of String.padStart in hot loops
**Learning:** Using `String(val).padStart(2, '0')` in hot rendering paths (like generating date string formatters) incurs significant JS-to-C++ allocation overhead compared to simple ternary logic (e.g., `val < 10 ? '0' : ''`). A benchmark revealed that `padStart` is an order of magnitude slower.
**Action:** Replace `padStart(2, '0')` with inline ternary string concatenation in all frequently called formatting functions to reduce overhead.
20 changes: 13 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2664,22 +2664,28 @@ function clamp(value, min, max) {
return Math.min(max, Math.max(min, value));
}

// ⚡ Bolt: Replace String.padStart with inline ternary for faster hot-path date formatting
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}-${d < 10 ? '0' : ''}${d}`;
Comment on lines 2669 to +2672
}

// ⚡ Bolt: Replace String.padStart with inline ternary for faster hot-path date formatting
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}-${d < 10 ? '0' : ''}${d}`;
}

// ⚡ Bolt: Replace String.padStart with inline ternary for faster hot-path date formatting
function formatCompactDate(date) {
return `${date.getFullYear()}${String(date.getMonth() + 1).padStart(2, '0')}${String(date.getDate()).padStart(2, '0')}`;
const year = date.getFullYear();
const m = date.getMonth() + 1;
const d = date.getDate();
return `${year}${m < 10 ? '0' : ''}${m}${d < 10 ? '0' : ''}${d}`;
}

function formatPercent(value, digits) {
Expand Down
Loading