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
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
## 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.

## 2025-05-23 - Reemplazo de O(N*M) a O(N) preservando semántica de break
**Learning:** Reemplazar un loop de búsqueda anidado O(N*M) con un diccionario O(N) puede alterar el comportamiento si hay duplicados. En Python, las comprensiones de diccionario sobrescriben claves, obteniendo el *último* match, mientras que el loop original con `break` obtiene el *primer* match.
**Action:** Al refactorizar loops con `break` hacia diccionarios (como en la asociación de ejercicios con soluciones), poblar el diccionario manualmente verificando `if key not in dict:` para garantizar el comportamiento original (first-match) al tiempo que se reducen las duraciones de procesamiento enormemente en escenarios de carga intensa (ej. 3.8s a 0.07s en benchmarks con 1000 items).
Loading