Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android floating point math performance

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?

like image 688
dbyrne Avatar asked Dec 23 '11 15:12

dbyrne


2 Answers

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.

That 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).

I'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.

like image 181
Randy Sugianto 'Yuku' Avatar answered Oct 18 '22 17:10

Randy Sugianto 'Yuku'


You could try to use APP_ABI := armeabi-v7a to force use of the v7a instructions only.
I 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.

like image 38
JimmyB Avatar answered Oct 18 '22 19:10

JimmyB