First let me state that I understand Groovy (and scripting languages in general) are going to be slower than a more native counterpart. However, I thought that in groovy's case things would level out once the groovy scripts were compiled to bytecode. This doesn't seem to be the case.
Ubuntu 7.10
Java 1.6.0_03-b05
Groovy 1.5.4
I created a groovy script and a Java class to read a text file containing 10,000 lines of text that were all the same length. I then executed each 20 times.
I created a the following groovy script:
Running this as a groovy script I averaged about 791 ms. I compiled the script and ran it as bytecode and averaged about 604 ms.
I then created the following Java class.
Running this averages at about 336 ms. So in review:
groovy script: 791 ms
groovy bytecode: 604 ms
java: 336 ms
I have to say that I was more surprised that the difference between groovy script and groovy compiled wasn't more. But I was still disappointed at the difference between groovy compiled and java; nearly twice as slow running the compile groovy code. I realize benchmarks like this don't mean a whole lot. I did expect a different outcome though.