I have an Java Fork/Join application which I want to benchmark 30 times. The execution of the program returns as output the time it needed to compute something. However, I read about warming up the JVM but I'm unsure on how to do this. I do this by means of the following .sh script:
for iteration in {1..30}
do
java -jar program.jar >> data.csv
done
Now my question, will the first X runs warm-up the JVM or will it not be able to optimize the program since I create a new process for every run? If so, do I need to put the for-loop into the program itself, or is there another way around?
The warm-up needs to be in the program. A standard JVM won't remember any JIT optimizations it does between invocations.