Why is std::sin() and std::cos() slower than sin() and cos()?

前端 未结 4 1806
小蘑菇
小蘑菇 2021-01-01 13:14

Test code:

#include 
#include 

const int N = 4096;
const float PI = 3.1415926535897932384626;

float cosine[N][N];
float sine[N][         


        
4条回答
  •  隐瞒了意图╮
    2021-01-01 13:40

    Use -S flag in compiler command line and check the difference between assembler output. Maybe using namespace std; gives a lot of unused stuff in executable file.

提交回复
热议问题