Linux-sxs.org features an informative article on how to compile Mozilla from source. Especially if you have switched to GCC 3.1, you can build some really optimized binaries for your Mozilla, as GCC 3.1 does better optimization in general, plus it supports special optimizations for Pentium4 or AthlonXP. A very simple example of how you could do that (you could add more parameters or modify to your liking or needs), is following. By exporting these variables to a terminal, you are making sure that all subsequent compilations in that session will use these optimizations. The following will work for all 686 (pentium-pro/PII/PIII etc architecture that is) CPUs and up.
export CXXFLAGS=”-O3 -march=i686 -mcpu=i686″
export CPPFLAGS=”-O3 -march=i686 -mcpu=i686″
export CFLAGS=”-O3 -march=i686 -mcpu=i686″
This will work for AthlonXPs:
export CXXFLAGS=”-O3 -march=athlon-xp -mcpu=athlon-xp”
export CPPFLAGS=”-O3 -march=athlon-xp -mcpu=athlon-xp”
export CFLAGS=”-O3 -march=athlon-xp -mcpu=athlon-xp”
And this one, for Pentium 4s:
export CXXFLAGS=”-O3 -march=pentium4 -mcpu=pentium4″
export CPPFLAGS=”-O3 -march=pentium4 -mcpu=pentium4″
export CFLAGS=”-O3 -march=pentium4 -mcpu=pentium4″
You get the idea. Other options for GCC 3.1 include i386, i486, i586, i686, pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp and athlon-mp. Get the list and additional optimization flags here.
If you got GCC 2.95.x or 2.96 (open a terminal and type: gcc -v, to check out what version you are running), I believe you are limited to these CPU types.
The Mozilla configure script as described in the Linux-sxs.org article, already contains this line:
–enable-optimize=’-O3 -march=i686 -mcpu=i686′
so, you will want to change it according to your CPU type as described above.
XFree 4.3 will have native support in its XFT library for Mozilla true type font anti-alias, but if you can’t wait till then, recompile the latest FreeType2 library by changing the #undef to #define in front of the “TT_CONFIG_OPTION_BYTECODE_INTERPRETER” line, in its [freetype2-src-dir]/include/freetype/config/ftoption.h file and then configure and compile.
Make sure you have read its unix Readme file, in order to make sure FreeType2’s ‘make install’ script will put the compiled libraries to the correct places for your distribution.
After you do all that, open up the /usr/lib/… or ~/mozilla/defaults/pref/unix.js file with a text editor and leave uncommented only this line: pref(“font.FreeType2.unhinted”, true); and hide its previous line: pref(“font.FreeType2.autohinted”, false); Then, remove the double slashes (comments) from: pref(“font.directory.truetype.2”, “/usr/X11R6/lib/X11/fonts/ttf”); and replace that last directory with the directory you have all your TTF web fonts installed on your X11 system. If you do not have the special Web Fonts installed yet, you can find them either at your C:\windows\fonts\ directory or on Microsoft’s web site as linked above.
I was just wondering if there was an optimised option for thoughs of us who don’t know how to roll our own. Any ideas or pointers?
Great…now that I know that it does Athlon XP optimizations, I have no choice but to recompile everything on my main system, just to see if I notice any performance increase. Why’d they have to tell me!?! Ignorance is bliss…..
Cal, if you want no-fuss, no-muss binaries for Windows, your best bet is Cygwin or MinGW. Right now MinGW has 3.1 available, but Cygwin is still showing 2.95, at least for their stable branch.
If you need optimized Windows binaries, do it the right Windows way, and use the latest Visual Studio, not with GCC. If you don’t have it, well, bad luck…
http://www.mozilla.org/build/win32.html
One really should turn on the -fomit-frame-pointer optimizations, its only needed for debugging. Turning
it on frees a cpu register, and generally speed things up _alot_
1) I believe that -march implies -mcpu, so it’s probably a little redundant to use.
2) Be careful about using -fomit-frame-pointer on an x86 system. Unless things have changed recently, one of Mozilla’s components actually depends on there being a frame pointer — I believe it’s nsprlib — and if you use -fomit-frame-pointer, you’ll just get a segfault on startup. (Disclaimer: I have only confirmed this with gcc-2.95.3 so far.)
Maybe you all that compiled and optimized from source could post if it made a (real) difference (in the case you tried a bin before make.
CB
Loading Mozilla 1.0 (Linux) is 2x faster. Loading new windows, preferences and so on is 1.5x faster. Not bad. Rendering time is somewhat the same, no noticible difference.
To Rajan r.
Did you compile it with optimized options ?
I confess I am too lazy to set 7/8 variables on win2K to compile it with a trial (3o days) Intel C compiler I got on a cover CD from ‘Linux magazine’.
I got the mozilla1.0.exe for win2K (it’s Saturday and I am suffering from too laziness
, It is good (1.0 or 1.x). Hicks…
Did you compile it with optimized options ?
There isn’t any optimize mode for my processor, a Duron 700mhz. You know, the one 2 years ago was the fastest thing…
I used GCC 3.1.0 on Mandrake Linux 8.2. Maybe it’s my connection speed..
After all, everything else is so much more faster. It is like comparing optimized KDE (with obj. prelinking, goodie) and binary KDE from Mandrake…
I spend 4 hours compiling this, tomorrow, I would sweet talk my friend that have a Athlon XP to allow me to compile it with Athlon XP optimization…. GCC 3.1 works on FreeBSD, right? He is using 4.4 (and he hates Linux, calls it a bloated pig from hell; which I kinda agree)
(and he hates Linux, calls it a bloated pig from hell; which I kinda agree)
Says the Mandrake guy… please go somwhere else with this kind of trolls. OS Forums -> OS Wars, or slashdot. Useless statements and comments aren’t appreciated in here.
Says the Mandrake guy… please go somwhere else with this kind of trolls. OS Forums -> OS Wars, or slashdot. Useless statements and comments aren’t appreciated in here
Apparently, I was comparing FreeBSD and Mandrake. And Mandrake is the most bloated thing out there, when compared with FreeBSD. That’s a fact. I’m using Mandrake currently because I’m still evaluating which distribution to jump on, or to jump on some BSD. The highest on the list right now is Gentoo Linux… (well, I can just pick the packages, burn in on a CD (I have a slow dial-up) and start, and walk away, come back in a day or two and have something completely non-blolated and totally optimized for my Duron Morgan I’m getting tommorrow. (I think Eugenia can back up that claim about Mandrake, which BTW, I didn’t made)
I’m no troll :-).
Are you sure it took so long on your Duron 700 ?
Guess I will gave it up, I have Celeron 1000.
(Some people just can’t accept criticism about Linux).
Are you sure it took so long on your Duron 700 ?
Guess I will gave it up, I have Celeron 1000.
(Some people just can’t accept criticism about Linux).
I dunno, I started the compile, went out, came back in 4 hours. Sticking around and waiting for something to finish compiling isn’t my cup of tea, it is BORING. (if you plan to stick around to wait for the compile to end, buy yourself a paperback novel, some magazines or a portable gaming console like gameboy..)
(Some people just can’t accept criticism about Linux).
Actually, that reminds me of me. Last time I was an all out Linux zealot. Say just one thing bad about Linux, and you would recieve my wrath. Then as Mandrake sucked more and more, I started rationalizing. For me, I kinda interested in freeBSD and it’s package manager…
Would be great if someone wrote something similar for
compiling OpenOffice.org, its not as straight forward
as Mozilla…
>Would be great if someone wrote something similar for compiling OpenOffice.org
It is all here:
http://www.openoffice.org/dev_docs/source/build_linux.html
Just make sure you have set the GCC flags as shown on our article, on the same terminal or session you are going to build openoffice.
Just be careful where the OpenOffice build page says:
$SRC_ROOT> tcsh
$SRC_ROOT> source LinuxIntelEnv.Set
Open the LinuxIntelEnv.Set file and check if there are any GCC flags over there. If yes, change them according to our GCC suggestions on our article.
You can install gentoo which is a source based distribution anyway with GCC 3.X.X and with the proper processor you will have a linux system that is more responsive than any other you have seen before it.
Sorry but I have to plug Gentoo every chance I get.
Would be great if someone wrote something similar for
compiling OpenOffice.org, its not as straight forward
as Mozilla…
I second that. I couldn’t get OpenOffice.org to compile properly using http://www.openoffice.org/dev_docs/source/build_linux.html
Maybe I would try again, one day.
it’s written there he use /usr/lib/qt3 as qtdir , does mozilla support qt3 ? cause i can’t get it to work , qt-mozilla list seems dead, the last message pointed that mozilla still use qt2 ..
err.. sorry for my english![;)](https://www.osnews.com/images/emo/smile.gif)
As you can see, he also enables GTK+, so the QT dir is for something else, not for building Mozilla’s GUI with QT.
BTW, if you are planning to re-compile QT, you will have to edit its configure script to enable optimizations, because it does not “listen” to GCC’s environmental variables.
With QT 2. I didn’t optimize it cause I didn’t know how to do so.. confusing little thing ;-).