gcc options for fastest code
Posted
by rwallace
on Stack Overflow
See other posts from Stack Overflow
or by rwallace
Published on 2010-06-09T12:01:11Z
Indexed on
2010/06/09
12:22 UTC
Read the original article
Hit count: 249
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 the category of programs that can use all the computing power they can get and still come back for more), given that I don't know in advance what hardware, operating system or gcc version the user will have, and I want above all else to make sure it at least works correctly on every major Unix-like operating system.
Thus far, I have g++ -O3 -Wno-write-strings
, are there any other options I should add? On Windows, the Microsoft compiler has options for things like fast calling convention and link time code generation that are worth using, are there any equivalents on gcc?
(I'm assuming it will default to 64-bit on a 64-bit platform, please correct me if that's not the case.)
© Stack Overflow or respective owner