Home:ALL Converter>Android floating point math performance

Android floating point math performance

Ask Time:2011-12-23T23:35:21         Author:dbyrne

Json Formatter

I have an Android application which uses the NDK to execute a large amount of floating point math.

I just acquired a new Galaxy Nexus. To my surprise, my app runs MUCH slower than it should. I suspect this is because most devices are using hardware acceleration and the Galaxy Nexus is not. If I perform an operation which does not require floating point math, the Galaxy Nexus performs how I would expect.

Here are the CPU/GPU specs and sample timings for several devices. I've normalized the stats to take into account display resolution:

Droid
CPU: TI OMAP 3430 (ARM Cortex-A8 600 MHz underclocked to 550 MHz)
GPU: PowerVR SGX530
Instruction Set: ARMv7
Test Run: 1,980 pixels per second

Galaxy Nexus
CPU: TI OMAP 4460 (ARM Cortex-A9 dual-core 1.2 GHz)
GPU: PowerVR SGX540
Instruction Set: ARMv7
Test Run: 2,253 pixels per second

Droid Incredible
CPU: QSD8650 (Qualcomm Snapdragon 1 GHz)
GPU: Adreno 200
Instruction Set: ARMv7
Test Run: 4,571 pixels per second

I have this configuration in my Application.mk file:

APP_ABI := armeabi armeabi-v7a

I have not re-compiled my code with NDK-r7, but I don't understand why this would make such a dramatic difference. Any idea what is wrong?

Author:dbyrne,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/8617789/android-floating-point-math-performance
Randy Sugianto 'Yuku' :

This StackOverflow question may be the cause of the poor performance on your Galaxy Nexus: Galaxy Nexus - wrong CPU ABI being selected during install time.\n\nThat seems to be a bug. I've tested it also by creating a small project using native code and indeed Galaxy Nexus chooses the wrong library (armeabi instead of armeabi-v7a). \n\nI've reported this bug at http://code.google.com/p/android/issues/detail?id=25321 , with the sample project attached on the bug. Please star it to bring attention to Android engineers.",
2012-02-09T08:03:01
JimmyB :

You could try to use\nAPP_ABI := armeabi-v7a\nto force use of the v7a instructions only.\nI could imagine that the new CPU is not detected as supporting v7a instructions and that thus the no-FPU code is used at runtime as a fallback.",
2011-12-23T16:21:29
yy