A VFP floating-point unit was configured on the iPhone 3G armv6 processor, which had higher bandwidth than the same integer calculations. GCC supports the creation of VFP instructions planned for pipelining. The iPhone 3GS and iPhone 4 armv7 processor does not have a VFP conveyor unit, and thus, in fact, it is slightly slower in some floating point sequences than the iPhone 3G; but the armv7 processor is faster in a vector short floating point, because instead it has a parallel NEON vector block. Some processors of Android devices do not have a floating point hardware module at all, so the OS uses software emulation for FP, which can be more than an order of magnitude slower than an integer or fixed one.
A general rule may be that if your algorithms can only process 24 bits of mantissa precision and donβt do many conversions between float and integer, use a short floating point on iOS. It is almost always faster.
But if you want to support older Android devices with your C code (using NDK), use a scaled integer.
If your application does not do a lot of crunches, for a typical application that does less than 0.1%, none of the above really makes a noticeable difference.
source share