|
|
Line 47: |
Line 47: |
| propagation improvements introduced in gcc 4.2. these are a major win for us. | | propagation improvements introduced in gcc 4.2. these are a major win for us. |
| </pre> | | </pre> |
|
| |
| =Distributions=
| |
|
| |
| <table class="fullwidth-table">
| |
|
| |
| <tr>
| |
| <th>
| |
| Name
| |
| </th>
| |
| <th>
| |
| GCC Version
| |
| </th>
| |
| <th>
| |
| Last Build
| |
| </th>
| |
| </tr>
| |
|
| |
| <tr>
| |
| <td>
| |
| Ubuntu 7.10
| |
| </td>
| |
| <td>
| |
| gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
| |
| </td>
| |
| <td>
| |
| 2.0.0.11+2nobinonly-0ubuntu0.7.10 (2008-01-07)
| |
| </td>
| |
| </tr>
| |
|
| |
| <tr>
| |
| <td colspan="3">
| |
| <b>gcc flags</b><br/>
| |
| -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -g -Wall -O2 -pthread -pipe
| |
| <br/><b>g++ flags</b><br/>
| |
| -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -g -Wall -O2 -fshort-wchar -pthread -pipe
| |
| <br/>
| |
| <b>configure flags</b>
| |
| --build=i486-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var '--libexecdir=${prefix}/lib/firefox' --disable-maintainer-mode --disable-dependency-tracking --srcdir=. --disable-debug --with-default-mozilla-five-home= --with-user-appdir=.mozilla --with-system-png=/usr --with-system-jpeg=/usr --with-system-zlib=/usr --with-system-nspr --with-system-nss --disable-composer --disable-debug --disable-elf-dynstr-gc --disable-gtktest --disable-installer --disable-ldap --disable-mailnews --disable-profilesharing --disable-strip --disable-strip-libs --disable-tests --disable-updater --disable-xprint --enable-application=browser --enable-canvas --enable-default-toolkit=gtk2 --enable-gnomevfs --enable-libthai '--enable-optimize=-pipe\ -w\ -O2\ -fno-strict-aliasing\ -g' --enable-pango --enable-postscript --enable-svg --enable-svg-renderer=cairo --enable-system-cairo --enable-mathml --enable-xft --enable-xinerama --enable-extensions=default --enable-single-profile --enable-system-myspell --with-distribution-id=com.ubuntu --enable-official-branding --enable-system-c
| |
| </td>
| |
| </tr>
| |
|
| |
| <tr>
| |
| <td>
| |
| Fedora 8
| |
| </td>
| |
| <td>
| |
| gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
| |
| </td>
| |
| <td>
| |
| firefox-2.0.0.10-3.fc8
| |
| (2008-01-04)
| |
| </td>
| |
| </tr>
| |
|
| |
| <tr>
| |
| <td colspan="3">
| |
| <b>gcc flags</b><br/>
| |
| -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -pthread -pipe
| |
| <br/><b>g++ flags</b><br/>
| |
| -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -fshort-wchar -pthread -pipe
| |
| <br/><b>configure flags</b><br/>
| |
| --enable-application=browser --prefix=/usr --libdir=/usr/lib --with-system-nspr --with-system-nss --with-system-jpeg --with-system-zlib --with-system-png --with-pthreads --disable-tests --disable-debug --disable-installer '--enable-optimize=-Os -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --enable-xinerama --enable-default-toolkit=gtk2 --disable-xprint --disable-strip --enable-pango --enable-system-cairo --enable-svg --enable-canvas --enable-startup-notification --enable-official-branding
| |
| </td>
| |
| </tr>
| |
|
| |
| <tr>
| |
| <td>
| |
| CentOS 5.1
| |
| </td>
| |
| <td>
| |
| gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
| |
| </td>
| |
| <td>
| |
| firefox-1.5.0.12-7.el5.centos (2008-01-07)
| |
| </td>
| |
| </tr>
| |
|
| |
| <tr>
| |
| <td colspan="3">
| |
| <b>gcc flags</b><br/>
| |
| -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -pthread -pipe
| |
| <br/><b>g++ flags</b><br/>
| |
| -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -fshort-wchar -pthread -pipe
| |
| <br/><b>configure flags</b><br/>
| |
| --enable-application=browser --prefix=/usr --libdir=/usr/lib --with-system-nspr --with-system-nss --with-system-jpeg --with-system-zlib --with-system-png --with-pthreads --disable-tests --disable-debug --disable-installer '--enable-optimize=-Os -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --enable-xinerama --enable-default-toolkit=gtk2 --disable-xprint --disable-strip --enable-pango --enable-system-cairo --enable-svg --enable-canvas --enable-official-branding
| |
| </td>
| |
| </tr>
| |
|
| |
| </table>
| |
|
| |
|
| =Distributions= | | =Distributions= |
Revision as of 22:10, 8 January 2008
Overview
Proper use of compiler options
Don't set a default optimization level for the entire browser build.
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. [1] If you want to use --enable-optimize, don't add extra optimization flags there. That's a global setting that sets optimization levels throughout the source tree. Instead pass non-optimization flags that you care about via CFLAGS and CXXFLAGS during the build.
Compilers
Notes from dwitte on gcc 4.3 vs. 4.1.2. [2] Also see the original post about possible ways to make gcc 4.1.2 faster as well by using -Os and -finline-limit.
i've tested gcc 4.3 a bit. to summarize, it looks like this pathological -Os
behavior is specific to 4.1 branch, and possibly just 4.1.2. also, there are
some substantial perf and codesize wins to be had with gcc 4.3.
gory details: tested with gcc 4.3 (20080104 pull). "stock configuration" is
"-Os -freorder-blocks -fno-reorder-functions". some Tp2 numbers:
baseline: gcc 4.3, stock: 142.78 ms
stock, with -finline-limit=50: 146.89 ms (+2.9%)
-O2: 131.56 ms (-7.9%)
for comparison with previous results (comment 0):
gcc 4.1.2, stock: 199 ms (+39%)
stock, with -finline-limit=50: 149.33 ms (+4.6%)
-O2: 142.67 ms (even)
|size libxul.so|
gcc 4.3, stock: 12,387kb
stock, with -finline-limit=50: 12,325kb (-62kb)
-O2: 15,061kb (+2,674kb)
gcc 4.1.2, stock: 13,249kb (+862kb)
stock, with -finline-limit=50: 13,025kb (+638kb)
-O2: 15,440kb (+3,053kb)
a few points from this data:
1) -Os is very sane on 4.3 by default.
2) on 4.3, relative to -Os, -O2 has improved a lot (8% Tp win, although at a
2.7Mb codesize cost).
3) 4.3 is 5 - 8% faster on Tp2 than 4.1.2, depending on -Os/-O2.
4) 4.3 gives an 400-800k codesize saving over 4.1.2.
3 & 4) are probably the same thing - a result of the hidden visibility
propagation improvements introduced in gcc 4.2. these are a major win for us.
Distributions
Name
|
GCC Version
|
Last Build
|
Ubuntu 7.10
|
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
|
2.0.0.11+2nobinonly-0ubuntu0.7.10 (2008-01-07)
|
gcc flags
-Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -g -Wall -O2 -pthread -pipe
g++ flags
-fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -g -Wall -O2 -fshort-wchar -pthread -pipe
configure flags
--build=i486-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var '--libexecdir=${prefix}/lib/firefox' --disable-maintainer-mode --disable-dependency-tracking --srcdir=. --disable-debug --with-default-mozilla-five-home= --with-user-appdir=.mozilla --with-system-png=/usr --with-system-jpeg=/usr --with-system-zlib=/usr --with-system-nspr --with-system-nss --disable-composer --disable-debug --disable-elf-dynstr-gc --disable-gtktest --disable-installer --disable-ldap --disable-mailnews --disable-profilesharing --disable-strip --disable-strip-libs --disable-tests --disable-updater --disable-xprint --enable-application=browser --enable-canvas --enable-default-toolkit=gtk2 --enable-gnomevfs --enable-libthai '--enable-optimize=-pipe\ -w\ -O2\ -fno-strict-aliasing\ -g' --enable-pango --enable-postscript --enable-svg --enable-svg-renderer=cairo --enable-system-cairo --enable-mathml --enable-xft --enable-xinerama --enable-extensions=default --enable-single-profile --enable-system-myspell --with-distribution-id=com.ubuntu --enable-official-branding --enable-system-c
|
Fedora 8
|
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
|
firefox-2.0.0.10-3.fc8
(2008-01-04)
|
gcc flags
-Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -pthread -pipe
g++ flags
-fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -fshort-wchar -pthread -pipe
configure flags
--enable-application=browser --prefix=/usr --libdir=/usr/lib --with-system-nspr --with-system-nss --with-system-jpeg --with-system-zlib --with-system-png --with-pthreads --disable-tests --disable-debug --disable-installer '--enable-optimize=-Os -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --enable-xinerama --enable-default-toolkit=gtk2 --disable-xprint --disable-strip --enable-pango --enable-system-cairo --enable-svg --enable-canvas --enable-startup-notification --enable-official-branding
|
CentOS 5.1
|
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
|
firefox-1.5.0.12-7.el5.centos (2008-01-07)
|
gcc flags
-Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -pthread -pipe
g++ flags
-fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -fshort-wchar -pthread -pipe
configure flags
--enable-application=browser --prefix=/usr --libdir=/usr/lib --with-system-nspr --with-system-nss --with-system-jpeg --with-system-zlib --with-system-png --with-pthreads --disable-tests --disable-debug --disable-installer '--enable-optimize=-Os -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' --enable-xinerama --enable-default-toolkit=gtk2 --disable-xprint --disable-strip --enable-pango --enable-system-cairo --enable-svg --enable-canvas --enable-official-branding
|