Are doubles faster than floats in C#?

前端 未结 10 866
[愿得一人]
[愿得一人] 2020-12-02 20:06

I\'m writing an application which reads large arrays of floats and performs some simple operations with them. I\'m using floats, because I thought it\'d be faster than doubl

10条回答
  •  醉酒成梦
    2020-12-02 20:21

    I have always thought that the processors were optimized or the same regardless of float or double. Searching for optimizations on my intensive computations (lots of gets from a matrix, comparisons of two values) I found out that floats run about 13% faster.

    This surprised me, but I guess it is due to the nature of my problem. I don't do casts between float and double in the core of the operations, and my computations are mainly adding, multiplying and subtracting.

    This is on my i7 920, running a 64-bit operating system.

提交回复
热议问题