How to favor speed over size?
-
Hello,
I am wondering if there is a project file command that allows to generate faster code? I am using QtCreator 2.3.1 under Windows, and compiling with MingW or MSVC2005.
Or is there a configuration file that I can edit to specify additional commands? E.g. for the MSVC2005 compiler, I could specify switches like "/O2", "/Ob2", "/Oi" or "/Ot", but where could I add those switches?
( I added following line to my project file, but this doesn't make a difference it seems: "CONFIG += fast" )
Thanks for any insight
-
Take a look at "LINK":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html, especially at "QMAKE_CXX":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html#id-729b5fe0-bf39-49b5-9cc8-f89aeff3d67a family of variables.
-
The release configuration for MinGW and MSVC adds
@
QMAKE_CFLAGS_RELEASE = -O2
@This is a sane default for speed optimizations. Unless you do number crunching or similar stuff that turns your CPU into a radiator, it's rarely necessary to change this.
-
Thanks to both of you!
I am actually turning my CPU into a radiator since it is about heavy calculations, so I am using following settings for maximum speed:CONFIG += fast
QMAKE_CXXFLAGS_RELEASE += -O2
QMAKE_CXXFLAGS_RELEASE += -Ob2
QMAKE_CXXFLAGS_RELEASE += -Oi
QMAKE_CXXFLAGS_RELEASE += -Ot
QMAKE_CXXFLAGS_RELEASE += -GLNot sure though if the "CONFIG += fast" is needed or has an effect whatsoever.
Cheers