floating point - Why does using float instead of double not improve Android performance? -


since smart phones (at least ones, can find specs on) have 32-bit processors, imagine using single precision floating-point values in extensive calculations perform better doubles. however, doesn't seem case.

even if avoid type casts, , use floatmath package whenever possible, can hardly see improvements in performance except memory use, when comparing float-based methods double-based ones.

i working on rather large, calculation intensive sound analysis tool, doing several million multiplications , additions per second. since double precision multiplication on 32-bit processor takes several clock cycles vs. 1 single precision, assuming type change noticeable... isn't :-(

is there explanation this? due way dalvik vm works, or what?

floating-point units on typical cpus perform of calculations in double-precision (or better) , round or convert whatever final precision is. in other words, 32-bit cpus have 64-bit fpus.

many phones have cpus include fpus, have fpus disabled save power, causing floating-point operations emulated (in case 32-bit floats advantage).

there vector units have 32-bit fpus, causing 64-bit floating-point operations take longer. simd units (like execute sse instructions) perform 32-bit , 64-bit operations in same amount of time, twice many 32-bit ops @ time, single 32-bit op won't go faster single 64-bit op.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -