CISC 673 - Project 1

Bryan Youse

Java Program:
/**
 * Test program for CISC 673 Project 1
 * @author Bryan Youse
 */

class dummy {
	public static void main(String[] args) {
		int loops = 500000000;
		int a = 0, b = 0, c = 0, d = 0;
		
		for(int i=0; i<loops; i++){
			if(a < 0)
				a = 3400;
			else
				a = -988;
			b = i * a + 445;
			if(a > b)
				c = a * b;
			else
				c = b / a;
			d = c / 43 + b;
		}

		for(int i=0; i<loops; i++){
			d /= 2;
			a -= b * 45;
			c = a * b;
		}
	}
}

Link to program: Dummy.java

Screenshot of runs:

Screep capture of two test runs.

The first command is with all optimizations in JikesRVM's O3 Optimization level turned on. The second command is with the optimization "unwhile", which converts while loops (and therefore the for loops within the program) into until loops, turned off. The awk and sed commands following the run are to weed out the real-time output from tcsh's time command.

Line graph of 30 runs with and without the optimization:

Line graph of 30 test runs.

This graph shows the unwhile optimization almost always resulting in a ~3 second improvement in running time. Inexplicably, two runs out of the thirty showed no performance degradation without the optimization, even though the program listed above contains no indeterminacy.