Are doubles faster than floats in C#?

前端 未结 10 827
[愿得一人]
[愿得一人] 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:22

    This indicates that floats are slightly faster than doubles: http://www.herongyang.com/cs_b/performance.html

    In general, any time you do a comparison on performance, you should take into account any special cases, like does using one type require additional conversions or data massaging? Those add up and can belie generic benchmarks like this.

提交回复
热议问题