Make Java fast: Optimize!

How to get the greatest performance out of your code through low-level optimizations in Java -- complete with a Benchmark applet

Page 2 of 3

The times for operations are given in nanoseconds, or billionths of a second, designated by "ns." While this is a very small increment of time, it actually may not be small enough to measure some operations accurately on very fast computers! If you are lucky enough to be using a fast machine, the benchmark will adjust the timing units to picoseconds (trillionths of a second), designated by "ps." If, on the other hand, your computer is slow, it may adjust back to using microseconds (millionths of a second), designated by "µs," or even all the way back to milliseconds (thousandths of a second), designated by "ms."

To run the Benchmark applet, select the tests you wish to run on the left, click the Run Benchmark button, and sit back and wait. Even moving the mouse around the screen can affect the accuracy of the benchmark, so just be patient while it runs the tests. You can stop the current test by clicking the Stop button, although it may take the applet a second or two to respond. Hitting Clear simply clears the text area. If Console is checked, the output will be mirrored to the Java console. If you want to save the results, you may need to check this.

| 1 2 3 Page 2