follow up to !3744
- avoid spurious copies
- avoid more complicated data structures than actually needed -- i.e. reduce memory consumption and improve memory layout
- avoid separate loops, and loops which use an induction variable when not needed, or induction variables which are defined outside the scope of the loop
Edited by Gerhard Raven