Speed Optimization on MobiAccess Virtual Machines (VMs)
Introduction:
We are pleased to announce that the optimization of MobiAccess Virtual Machines started in the last few days. We conducted the optimization of methods (Add, Subtract, Divide, And, Or) used by the basic language types (Integer, Long, Byte, Double, Boolean, etc.) in the first tier.
The Issue
MobiAccess VM does not recognize the notion of primitives and operators as it is. Because of this, every operation is a method call (eg. i1.Add(i2)). This sort of approach makes the code of the VM much simpler, clearer and easier to use. In most cases it does not cause any issues or overhead, but this differs in methods utilizing operators.
MobiAccess compiler translates such methods to method calls, which, however, causes significant overhead in the case of these elementary operations.
The Solution
The solution for the issue presented itself when we decided to filter these methods (Add, Subtract, etc.) at method call, and instead of running a method, we execute the operation natively and return the result. Thus we avoid the expenses of creating MethodFrame on operations.
The Result
After concluding the optimization phase, we wrote a little test program that shows us how much faster (or slower, for that matter) the virtual machine has become after the adjustment. In this test we executed simple operations in a ’for’ loop (+,-,/,*,%).
And the result:
Android: Faster by 31%
BlackBerry: Faster by 54%
Further Conclusions
Naturally, optimization is not yet concluded. We are working hard on enhancing MobiAccess speed and usability continually, and we are going to report on our progress in the future as well.
Written by DI





