Android的浮点运算性能 [英] Android floating point math performance

查看:1194
本文介绍了Android的浮点运算性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Android应用程序它使用NDK来执行大量的浮点运算。

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

我刚刚获得了新的Galaxy Nexus的。令我惊讶的是,我的应用程序运行速度变得比它应该更慢。我怀疑这是因为大多数设备都使用硬件加速和Galaxy Nexus的不是。如果我执行不需要浮点运算的操作时,Galaxy Nexus的执行如何,我期望的那样。

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.

下面是CPU / GPU规格和采样定时为多台设备。我已经标准化的统计数据,考虑到显示分辨率:

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

我在 Application.mk 文件此配置:

APP_ABI := armeabi armeabi-v7a

我还没有重新编译我的code与NDK-R7,但我不明白为什么会做出这样一个显着的差异。任何想法有什么不好?

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?

推荐答案

您可以尝试使用 APP_ABI:= armeabi-V7A 强制使用仅V7A说明。
我能想象,新的CPU不被检测为支持V7A指令和因此没有-FPU code运行时使用的替代。

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.

这篇关于Android的浮点运算性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆