CS 412/413
Introduction to Compilers
Spring 2001

Nested Loops

Executes 7 perfectly-nested for loops (well, the equivalent while loops, since we don't have fors in Iota).  The bounds on each loop are [0,N).  The body of the innermost loop is an increment operation.  Thus the running time of the program is O(N7).  This tests the efficiency of the code your compiler generates for loops, and to a lesser extent, the increment operator.  Loop unrolling would be an effective optimization.

Source: [NestLoop.im nestloop.cpp NestLoop.java]
Input:
N=24
Output:
The final value (191,102,976) of the increment variable.

C++ 0.81
C 2.03
D 2.33
Java 2.33
B 2.56
F 3.17
E 3.22
A 8.14
H 9.93
G 11.2