Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
**Learning:** Using `Array.from(map.values()).map(...)` creates an unnecessary intermediate array which wastes memory allocation and garbage collection time, particularly for frequently re-rendered components handling large collections.
**Action:** Use a `for...of` loop over `map.values()` to iterate and push mapped elements directly into the final array for O(1) memory and avoiding intermediate array allocations.

## 2025-02-23 - Short-circuiting known absolute bounds
**Learning:** Using unconditional `.reduce()` to find a minimum or maximum value forces O(N) iteration, which is wasteful when an absolute bound (e.g., finding a 'low' confidence level) is known and can be found early.
**Action:** For performance optimizations involving finding a minimum/maximum value with a known absolute bound, replace unconditional `.reduce()` calls with a `for...of` loop and an early `break` to short-circuit the operation.

## 2026-03-12 - O(1) early exit for confidence level
**Learning:** Using `.reduce()` unconditionally iterates over the entire array for operations with an absolute bound (e.g. finding if there's any 'low' confidence section).
**Action:** Replace unconditional `.reduce()` with a `for...of` loop and early `break` to short-circuit upon finding the minimum possible bound, changing O(N) worst-case into an O(K) best-case execution, yielding measurable performance gains on large documents.
Loading