[Interest] armv7a-hard-float in Qt android apps

Ola Røer Thorsen ola at silentwings.no
Fri Apr 29 13:55:05 CEST 2016


2016-04-29 10:11 GMT+02:00 Nuno Santos <nunosantos at imaginando.pt>:

>
> Code compiled and ruined fine but couldn’t notice a faster performance (I
> have profiling timers in critical parts of the application).
>
> Has anyone done this before?
>
>
As far as I know Qt is built with qreal as double as a default setting.

In case your cpu only does single precision floats in hardware:

Maybe try to build Qt with qreal as single precision floats?
I think the Qt configure option is "-qreal float", please check to be sure.

Makes a notable difference on my ancient arm omap3 processor, at least.

Also I'd recommend using the gcc warnings
-Wdouble-promotion
-Wfloat-conversion
and make sure you are just using single precision floats as much as
possible. Lots of performance is lost if you keep mixing single- and double
precision.

float a = 1.0f;
float b = 2.0*a; // BAD!
float b = 2.0f*a; // Good!

Make sure you are using single-precision math functions (use std::sin,
std::abs, not cmath sin, abs, etc). The warnings above will show you all
these cases.

Cheers,
Ola
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160429/9283b347/attachment.html>


More information about the Interest mailing list