December 20, 2011

floatingWoods floatingWoods
Lab Rat
53 posts

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

3 replies

December 20, 2011

sierdzio sierdzio
Area 51 Engineer
2307 posts

Take a look at LINK [developer.qt.nokia.com], especially at QMAKE_CXX [developer.qt.nokia.com] family of variables.

 Signature 

(Z(:^

December 21, 2011

Volker Volker
Robot Herder
5428 posts

The release configuration for MinGW and MSVC adds

  1. 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.

December 21, 2011

floatingWoods floatingWoods
Lab Rat
53 posts

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 += -GL

Not sure though if the “CONFIG += fast” is needed or has an effect whatsoever.

Cheers

 
  ‹‹ How to build mysql plugin with static Qt?      include path added but still not able to include files ››

You must log in to post a reply. Not a member yet? Register here!