Your tests are pretty useless. Most modern compilers will optimize away all of that code so what you are measuring is the overhead of your timing code.
That being said interpreted byte code is slow. Either write native code where it matters or wait for JIT. On Jan 6, 9:08 am, Biosopher <[email protected]> wrote: > I'm writing a processing intensive digital sound processing app > (requires numerous (50,000) Fast Fourier Transforms - FFT). This > challenge led me to perform basic performance tests of Android running > on an HTC Hero. > > The results show the Dalvik VM to be >20 times slower than a modern > JIT-enabled JVM running J2ME and 25-50 times slower than a C program > performing the same operations on a similarly powered mobile phone. > > For example, this simple iteration over an empty method 2 million > times takes 1.4 seconds even though it doesn’t do anything. The same > iteration is performed in milliseconds by a C program and about 100ms > on a modern JVM > > public void performanceTest1() { > for (int i = 0; i < 2000000; i++) { > emptyMethod(); > } > > } > > private int emptyMethod() { > return 0; > > } > > Doing something a little more complex like calculating the imaginary > component of a complex conjugate 2 million times takes 3.2 seconds. > Again, this takes milliseconds on other mobile phones running J2ME or > C. > > public void performanceTest2() { > for (int i = 0; i < 2000000; i++) { > int a = 5; > int b = 5; > int c = 5; > int x = 5; > int y = 5; > > y = ((a >> 16) * ((c << 16) >> 16)) + (((a & 0X0000FFFF) * > ((c << > 16) >> 16)) >> 16); > y = -y; > y += ((b >> 16) * (c >> 16)) + (((b & 0X0000FFFF) * (c >> > 16)) >> > 16); > } > > } > > Has anyone else been able to overcome these performance issues of > Android?
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

