Difference between revisions of "Fs2 open on Linux/Optimization"

From FreeSpace Wiki
Jump to: navigation, search
Line 8: Line 8:
 
<p></p>{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
<p></p>{{Note| This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.}}
 
Optimizing fs2_open might have little or no effect, or improve performance greatly, I honestly have no clue.<br>
 
Optimizing fs2_open might have little or no effect, or improve performance greatly, I honestly have no clue.<br>
You can specify your compiler flags with the configure script, se below.
+
You can specify your compiler flags with the configure script, see below.
 
  $ ./configure CFLAGS="<your desired flags>"
 
  $ ./configure CFLAGS="<your desired flags>"
 
If you want to play it safe, a good set of CFLAGS would be
 
If you want to play it safe, a good set of CFLAGS would be
Line 15: Line 15:
 
Note: it seems that in GCC 4.7.0 (and higher until at least 4.7.2) the -ftree-vectorize flag (part of -O3) causes segfaults in FSO.  Therefore you could instead use:
 
Note: it seems that in GCC 4.7.0 (and higher until at least 4.7.2) the -ftree-vectorize flag (part of -O3) causes segfaults in FSO.  Therefore you could instead use:
 
  $ ./configure CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -fno-ident -finline-functions -funswitch-loops -fpredictive-commoning -fgcse-after-reload -fipa-cp-clone" CXXFLAGS="$CFLAGS"
 
  $ ./configure CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -fno-ident -finline-functions -funswitch-loops -fpredictive-commoning -fgcse-after-reload -fipa-cp-clone" CXXFLAGS="$CFLAGS"
 +
 +
In particular, the following flag has been reported to increase the FPS when not looking at nebula:
 +
$ -fpredictive-commoning
  
 
You should read up on CFLAGS and what they do before trying anything. I recommend you read through these links (adjust the URL as required for your version of GCC).<br>
 
You should read up on CFLAGS and what they do before trying anything. I recommend you read through these links (adjust the URL as required for your version of GCC).<br>

Revision as of 09:18, 31 December 2012

« Pre-Compile Configuration The fs2_open on Linux Guide
Optimization
Compiling »

Warning: If you compile a debug build, don't use the -fomit-frame-pointer and -fno-ident compiler flags, as it will make debugging impossible.

Note: This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.

Optimizing fs2_open might have little or no effect, or improve performance greatly, I honestly have no clue.
You can specify your compiler flags with the configure script, see below.

$ ./configure CFLAGS="<your desired flags>"

If you want to play it safe, a good set of CFLAGS would be

$ ./configure CFLAGS="-march=native -O3 -pipe -fomit-frame-pointer -fno-ident" CXXFLAGS="$CFLAGS"

Note: it seems that in GCC 4.7.0 (and higher until at least 4.7.2) the -ftree-vectorize flag (part of -O3) causes segfaults in FSO. Therefore you could instead use:

$ ./configure CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -fno-ident -finline-functions -funswitch-loops -fpredictive-commoning -fgcse-after-reload -fipa-cp-clone" CXXFLAGS="$CFLAGS"

In particular, the following flag has been reported to increase the FPS when not looking at nebula:

$ -fpredictive-commoning

You should read up on CFLAGS and what they do before trying anything. I recommend you read through these links (adjust the URL as required for your version of GCC).
http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Optimize-Options.html
http://gentoo-wiki.com/Safe_Cflags