Comment by ahartmetz
1 hour ago
You want to avoid branches in hot paths. If you branch inside the loop, lots of branches. If you branch outside the loop (into different specialized loops), few branches. Big fucking deal.
1 hour ago
You want to avoid branches in hot paths. If you branch inside the loop, lots of branches. If you branch outside the loop (into different specialized loops), few branches. Big fucking deal.
https://en.wikipedia.org/wiki/Loop_unswitching
Slower but prettier with the if pushed down.