Groovy has a performance problem, compared with Java, due to its dynamic nature, while there are several requests for performance improvement.
Implementing just-in-time compiler is a proper way to help boosting performance of Groovy. It would be great to have a Groovy module (in this case a JVMTI agent) to help transform/redefine Groovy classes during runtime.
As of Groovy 1.6-beta series, its performance has been improved but there are still problems occurred from primitive operations. All operand and results are heavily boxed and unboxed when primitive variables are used. The current implementation of GJIT provides the algorithm to unwrap almost binary operations back to be primitive. Thus, it can speed Groovy performance up when dealing with arithmetic calculation.
This is the completely re-written version of GJIT. Basically, GJIT can be thought as a Hotspot-like compiler for Groovy. However it is working outside JVM, and not a part of the virtual machine. GJIT uses JVMTI, the virtual machine tool interface, to:
Due to the use of JVMTI, GJIT supports Java 5 or later.
Add
-javaagent:gjit.jar |
to your Java command line to use GJIT.