Posts Tagged ‘jvm’

Testing a few different JVMs

23 August 2008

So I found that Sun’s HotSpot Java VM does a fair bit of optimisation, and so the cases where my optimisations actually improve program performance are more limited than I thought they might have been. However, there are plenty of other JVMs around without so much run-time optimisation. I have tested here a number of free JVMs, but it is likely that similar results would be found in the JVMs used on many small devices such as cellphones.

I tried JamVM, GIJ, CACAO and Kaffe, as well as Sun Java 1.5.0 and 1.6.0 for comparison.

Here are the times I got (running a similar test to last time, though not using interfaces to confuse the JIT optimiser and using a smaller size for the test as some of the VMs were quite slow):

andrew@rimu:~/COMP489/test cases$ java ManualMethod #Sun Java 1.6.0_07
Normal: 15 ms
Normal: 34 ms
Normal: 32 ms
Factored: 32 ms
Factored: 31 ms
Factored: 29 ms
Side effects: 0
andrew@rimu:~/COMP489/test cases$ java ManualMethod #Sun Java 1.5.0
Normal: 46 ms
Normal: 46 ms
Normal: 46 ms
Factored: 61 ms
Factored: 39 ms
Factored: 39 ms
Side effects: 0
andrew@rimu:~/COMP489/test cases$ jamvm ManualMethod
Normal: 812 ms
Normal: 837 ms
Normal: 825 ms
Factored: 230 ms
Factored: 230 ms
Factored: 241 ms
Side effects: 0
andrew@rimu:~/COMP489/test cases$ gij ManualMethod
Normal: 3288 ms
Normal: 3228 ms
Normal: 3188 ms
Factored: 287 ms
Factored: 287 ms
Factored: 286 ms
Side effects: 0
andrew@rimu:~/COMP489/test cases$ cacao ManualMethod
Normal: 65 ms
Normal: 76 ms
Normal: 76 ms
Factored: 11 ms
Factored: 10 ms
Factored: 11 ms
Side effects: 0
andrew@rimu:~/COMP489/test cases$ kaffe ManualMethod
Normal: 284 ms
Normal: 307 ms
Normal: 317 ms
Factored: 10 ms
Factored: 10 ms
Factored: 10 ms
Side effects: 0

It seems from this that many VMs have less (or perhaps no) optimisation and greater overheads to method calls, and so in these cases my optimisations are quite helpful. Even the older 1.5.0 version of Sun’s HotSpot VM seems to benefit from my optimisations to the bytecode.