CompileThreshold server jvm option
I have been playing with the -XX:CompileThreshold jvm option for a benchmark of my application, and I don't understand the results.
When I put CompileThreshold very low, like for instance 10, the performance is worst. If I put it higher it gets slowly better until around 10.000, where performance starts to stabilize. I have understood that this is the default for Sun's server JVM, so I could just as well leave the CompileThreshold setting for what it is.
But I don't understand why performance is worst for the lowest value?
My benchmark consists of very many floating point arithmetic calculations and heavy physical memory access. A number of cases are calculated and timings are measured in a one batch.
This complete batch I run 3 times to let the JIT compiler do its work and I use only the timings of the 3rd run. Every time I can see a big performance difference between the 1st and the 2nd run, the 3rd run is almost the same as the 2nd run.
My understanding of CompileThreshold was, that the lower you put its value, the less iterations of some code were needed to let the JIT compiler start compiling it. So if I would put it very low I would see a big performance slowdown in the very short run, but the same or slightly better performance soon after that. However this is not what I see happening. What's going on here?