Quick Optimization
Java byte code can be modified at runtime for better performance. The optimization dynamically replaces certain JVM instructions, the first time they are executed, by internal, more efficient variants. The quick pseudo instructions are faster by exploiting the fact that the first time the instruction referencing the constant pool must dynamically resolve the constant pool entry, subsequent invocations of that same instruction must reference the same object and need not resolve the entry again.
Example:
The following example is an approximation of the bytecode optimization done at runtime, represented in Java.
In the code fragement below, the getfield instruction generated for obj.i can be replaced by getfield_quick at runtime.
{ for(i = 0; i < 10; i++) arr[i] = obj.i + volatile_var; }
Below is the code fragment after Quick Optimization.
{ t = obj.i; for(i = 0; i < 10; i++) arr[i] = t + volatile_var; }
Notes:
Quick Optimization is optimization at run time.
Quick Optimization is very significant because unnecessary references to the constant pool can be done away thus making execution time faster.