performance
Installation
SKILL.md
Performance
Avoid nested loops and O(n^2) operations unless there is a clear reason.
- Calculate expensive values once before a loop, not inside it.
- Prefer precomputed maps, sets, indexes, or a single backward scan over nested repeated scans.
- If you need to know whether meaningful elements remain, compute that boundary once before the main loop.
Example of the preferred pattern: