Linux/Compiler Options: Difference between revisions

Jump to navigation Jump to search
revise based on dwitte's comments
(add note about using the chart below)
(revise based on dwitte's comments)
Line 3: Line 3:
==Proper use of compiler options==
==Proper use of compiler options==


'''Don't set a default optimization level for the entire browser build.'''
'''For Firefox 3 builds, please use --enable-optimize without flags.'''


Different parts of Mozilla run faster at different optimization levels.  For example, cairo, pixman and sqlite are compiled at -O2 because they are fastest at that level while the JS engine is fastest at -Os. [https://bugzilla.mozilla.org/show_bug.cgi?id=409803#c9]  If you want to use --enable-optimize, don't add extra optimization flags there.  That's a global setting that sets optimization levels [http://lxr.mozilla.org/seamonkey/search?string=MODULE_OPTIMIZE_FLAGS throughout the source tree].  Instead pass non-optimization flags that you care about via CFLAGS and CXXFLAGS during the build.
Our testing has shown that different parts of Mozilla run faster at different optimization levels.  For example, cairo, pixman and sqlite are compiled at -O2 because they are fastest at that level while the JS engine is fastest at -Os. [https://bugzilla.mozilla.org/show_bug.cgi?id=409803#c9]  Don't use --enable-optimize as a place to pass in random compile flags.  That's a global setting that sets optimization levels [http://lxr.mozilla.org/seamonkey/search?string=MODULE_OPTIMIZE_FLAGS throughout the source tree] and is different depending on the module being compiled.


'''Please use the right optimization flags for your compiler.'''
If you still need to pass in other non-optimization flags to the compile, please use CFLAGS and CXXFLAGS instead of passing them to --enable-optimize.


Please see the chart below for information on what compiler flags you should be usingIt depends on what compiler you have.
'''For Firefox 2 builds, you probably want to set a default optimization level.'''
 
The default optimization level on the 1.8 branch (a.k.a Firefox 2) is -O3 which is too aggressive and trades off a lot of space for not much speed.  So you probably want to use --enable-optimize="..." for this release.
 
If you're using gcc 4.1.x you should use -O2 to make things go as fast as possible.  This will result in about a 2MB code size hit.  If you want to avoid that code size hit you can specify "-Os -finline-limit=100" which gives back most of the performance without too much code size growth.  See the notes below.
 
For gcc 4.3.x you can use -O2 for your buildsThe size hit is smaller because of visibility changes in that release of the compiler.


=Compilers=
=Compilers=
canmove, Confirmed users
1,577

edits

Navigation menu