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 @@ -6,3 +6,6 @@
## 2025-05-20 - Pre-compiling Regex in Loops
**Learning:** `re.findall(pattern, string)` recompiles (or retrieves from cache) the pattern on every call. In high-frequency functions called inside loops (like complexity estimation), this overhead adds up.
**Action:** Always pre-compile regexes (`re.compile`) into module-level or class-level constants if they are used repeatedly, especially in tight loops or recursive functions.
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

Falta una línea en blanco antes de este encabezado ## para mantener el formato consistente entre secciones en Markdown (mejora la legibilidad y evita que algunos renderizadores lo peguen al bloque anterior).

Suggested change
**Action:** Always pre-compile regexes (`re.compile`) into module-level or class-level constants if they are used repeatedly, especially in tight loops or recursive functions.
**Action:** Always pre-compile regexes (`re.compile`) into module-level or class-level constants if they are used repeatedly, especially in tight loops or recursive functions.

Copilot uses AI. Check for mistakes.
## 2025-05-24 - O(N*M) Loop to O(N) Dictionary Lookup Refactor
**Learning:** Nested loops (O(N*M)) for mapping relational data (like exercises to their solutions) can be a significant performance bottleneck. Refactoring to build a pre-computed dictionary (hash map) reduces the time complexity to O(N), yielding order-of-magnitude speedups for large data sets. However, when simulating the behavior of a `break` statement in the original loop, a naive dictionary comprehension will map the *last* matching item.
**Action:** When refactoring search loops with a `break` to dictionary lookups, populate the dictionary manually and check `if key not in dict:` to preserve the *first-match* behavior safely.
Loading