Fast way to Implement a Loop

Please provide a self-contained working example, which includes the variants you have tried and the way you are benchmarking them.