I am currently working on a C++ project on Windows. It is computationally expensive involving a lot of random numbers generation and calculation of special math functions (e.g. gamma).
Code compiled with windows compiler (MSVC) is consistently almost 3 times faster than that produced by g++ (version 6.3.0). Here are the flags I use for each of them:
Flags for MSVC are /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /Zi /O2 /Ob1
g++ -std=c++11 -O3 -ffast-math
I've checked that bare random numbers generation is slightly faster on g++. Amount of computations which must be done vary with each run and is random but it is possible to estimate it quite corretly afterwards. Windows code is faster even if it has more work to do.
Both versions of the program work correctly, there are no compiler warnings.
Do you have any idea why that may be the case? Am I missing some flags on g++?
Aucun commentaire:
Enregistrer un commentaire