You'll have to use the NDK and write some native C code to do your
math, that will speed it up a lot. And use fixed point if you need
floats.

-niko

On Jan 6, 11:08 am, Biosopher <biosop...@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to