A few tips for efficient loops:
Cache the length if it won't change: len() is cheap but not free in tight loops.
Avoid allocations inside loops: declare variables outside when possible.
Use break early: exit as soon as you can.
Consider the algorithm: a better algorithm beats micro-optimizations. An O(n) loop beats an optimized O(n²) loop.