GCC recommendations and options for fastest code

前端 未结 7 1489
野趣味
野趣味 2020-12-23 18:34

I\'m distributing a C++ program with a makefile for the Unix version, and I\'m wondering what compiler options I should use to get the fastest possible code (it falls into t

7条回答
  •  死守一世寂寞
    2020-12-23 19:05

    You should certainly, apart from what others have already suggested, try -flto. It enables link time optimization which, in some cases, can really do magic.

    For further information see https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

提交回复
热议问题