We all know that
For Android 2.2Of
JITPerformance has been substantially improved, but for older versions of Programs
JavaExecution efficiency also has many language features,
In Java 1.5Then there will be significant improvements. The following example is from
SDK:
Static class Foo {int msplat;} Foo [] marray =... // The execution result and performance of the above static class Foo are divided into three methods: zero, one, and two for comparison. Public void zero () {// Most people may simply write int sum = 0; For (INT I = 0; I <marray. length; ++ I) {sum + = marray [I]. msplat ;}} public void one () {// improve the performance through local objects int sum = 0; Foo [] localarray = marray; int Len = localarray. length; For (INT I = 0; I <Len; ++ I) {sum + = localarray [I]. msplat ;}} public void two () {// recommended method. The new syntax feature of Java 1.5 can greatly improve the performance of int sum = 0; For (foo a: marray) {sum + =. msplat ;}}
Zero () slowest,One () Faster,Two () is the fastest, I hope this will help you.