Skip to content
Open
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 @@ -16,3 +16,6 @@
## 2024-06-28 - Optimize array lookups in high-frequency React event handlers
**Learning:** Even if data is pre-processed/memoized (like cached `parsedTimestamps`), performing an O(N) linear search on that array inside a high-frequency event handler (like `<video onTimeUpdate>`, which fires multiple times per second) can cause UI stuttering for large arrays.
**Action:** When searching sorted arrays (like ordered video timestamps) in high-frequency event loops, replace linear iteration loops with an O(log N) binary search to minimize main thread blocking and ensure smooth UI execution.
## 2026-08-19 - Fast path for timestamp parsing
**Learning:** For highly predictable string formats (like video timestamps HH:MM:SS.mmm), string splitting and generator comprehensions introduce unnecessary object allocation overhead.
**Action:** Use direct substring indexing and float casting as a fast path to improve performance during frequent parsing operations.
6 changes: 5 additions & 1 deletion backend/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ def _escape_drawtext(text: str) -> str:
return text

def _ts_to_seconds(ts: str) -> float:
parts = ts.strip().split(':')
ts = ts.strip()
# ⚑ Bolt: Fast path for standard HH:MM:SS.mmm timestamps to avoid string split/generator overhead
if len(ts) >= 8 and ts[2] == ':' and ts[5] == ':':
return float(ts[0:2]) * 3600 + float(ts[3:5]) * 60 + float(ts[6:])
parts = ts.split(':')
return sum(float(v) * m for v, m in zip(reversed(parts), [1, 60, 3600]))

def _hex_to_ffmpeg(color: str) -> str:
Expand Down
Loading