This section provides a performance comparisons between 'int' and 'long' loops and basic operations in interpreted-only mode. 'int' runs much faster.
If you compare testing results between "int" and "long" loops, you will see that:
loops with "long" indexes run much slower than "int" indexes as bytecodes (interpreted-only mode) with HotSpot JVM.
Here are comparisons of execution times per step in nanoseconds:
By subtracting assignment loop execution time from shift, add, multiply and division tests,
we can get execution estimates for shift, add, multiply and division operations in nanoseconds:
int long
Shift: i<<1 3 6
Add: i+i 3 10
Multipply: i*3 3 14
Divide: i/3 5 29
Conclusion: Use "int" data type instead of "long" as much as you can to get better execution performance in interpreted-only mode.