Results for Fedora Core 6
Sergey Edunov sent along results for Fedora Core 6, along with the following interesting
analysis:
I've tried your sample on my linux box and found some interesting results. You can see
that with -server option set the "hardcore iterative" became the best one. It seems that
-server option causes a serious performance degradation of recursive calls, while
iterative approach became much faster.
Linux: Fedora Core 6, kernel 2.6.18-1.2849
Processor: Intel Pentium 4 CPU 2.80GHz
Java: Java(TM) SE Runtime Environment 1.6.0-b105
Table 1: java -server RecursionTester
| Solution |
Time (ns) |
Heap (bytes) |
| Elegant Recursion |
12,735,590 |
2,516,720 |
| Fast Recursion |
8,216,203 |
0 |
| Elegant Iterative |
17,320,358 |
2,517,323 |
| Fast Iterative |
14,057,372 |
251,673 |
| Hardcore Iterative |
6,888,792 |
252,064 |
Table 2: java -client RecursionTester
| Solution |
Time (ns) |
Heap (bytes) |
| Elegant Recursion |
15,875,555 |
1,108,004 |
| Fast Recursion |
4,566,082 |
0 |
| Elegant Iterative |
35,996,823 |
1,107,893 |
| Fast Iterative |
19,545,499 |
26,707 |
| Hardcore Iterative |
5,141,278 |
26,728 |
|