/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® quad-core |
Each table row shows performance measurements for this Java 7 program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 10 | 0.81 | 0.76 | 14,700 | 514 | 66% 0% 99% 25% |
| 11 | 5.73 | 5.69 | 14,672 | 514 | 68% 100% 0% 20% |
| 12 | 87.01 | 86.98 | 14,712 | 514 | 1% 0% 100% 0% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read fannkuch-redux benchmark to see what this program should do.
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) Server VM (build 23.6-b04, mixed mode)
/* The Computer Language Benchmarks Game http://benchmarksgame.alioth.debian.org/ contributed by Isaac Gouy converted to Java by Oleg Mazurov */ public class fannkuchredux { public static int fannkuch(int n) { int[] perm = new int[n]; int[] perm1 = new int[n]; int[] count = new int[n]; int maxFlipsCount = 0; int permCount = 0; int checksum = 0; for(int i=0; i<n; i++) perm1[i] = i; int r = n; while (true) { while (r != 1){ count[r-1] = r; r--; } for(int i=0; i<n; i++) perm[i] = perm1[i]; int flipsCount = 0; int k; while ( !((k=perm[0]) == 0) ) { int k2 = (k+1) >> 1; for(int i=0; i<k2; i++) { int temp = perm[i]; perm[i] = perm[k-i]; perm[k-i] = temp; } flipsCount++; } maxFlipsCount = Math.max(maxFlipsCount, flipsCount); checksum += permCount%2 == 0 ? flipsCount : -flipsCount; // Use incremental change to generate another permutation while (true) { if (r == n) { System.out.println( checksum ); return maxFlipsCount; } int perm0 = perm1[0]; int i = 0; while (i < r) { int j = i + 1; perm1[i] = perm1[j]; i = j; } perm1[r] = perm0; count[r] = count[r] - 1; if (count[r] > 0) break; r++; } permCount++; } } public static void main(String[] args){ int n = 7; if (args.length > 0) n = Integer.parseInt(args[0]); System.out.println("Pfannkuchen("+n+") = "+fannkuch(n)); } }
Mon, 21 Jan 2013 04:50:16 GMT MAKE: mv fannkuchredux.java-2.java fannkuchredux.java /usr/local/src/jdk1.7.0_11/bin/javac fannkuchredux.java 0.50s to complete and log all make actions COMMAND LINE: /usr/local/src/jdk1.7.0_11/bin/java -server -XX:+TieredCompilation -XX:+AggressiveOpts fannkuchredux 12 PROGRAM OUTPUT: 3968050 Pfannkuchen(12) = 65