mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 02:12:00 +03:00
* Extracted multiple `.toLowerCase()` calls on identical characters during unit concatenation and phrase generation * Cached the lowercased strings in parallel arrays during `csPhrases` initialization * Preserves all functional string behavior Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
3 lines
707 B
Markdown
3 lines
707 B
Markdown
## 2025-07-08 - Optimize string lowercasing in nested loops
|
|
**Learning:** In nested loops generating combinations of strings (like symbols and prefixes), repeated calls to `.toLowerCase()` on the concatenated string create an overhead. Caching the lowercase strings during concatenation using parallel arrays is an effective strategy to eliminate redundant operations, but extracting the loop variable correctly when restructuring the iteration pattern is crucial to maintain compile safety.
|
|
**Action:** Prioritize lowercasing loop variables at the earliest possible stage and ensure that when caching results in arrays, corresponding iteration logic consistently references the indexed values correctly.
|