21 Jan 2008

can firefox be improved just by recompiling ?

I took an Engineering class a year ago that was all about compilers and Computer Architecture.
Using GCC, (which used to stand for GNU C Compiler, but now stands for GNU Compiler Collection, as it does more than just compile C) a C compiler, you’re able to do much more than merely compile.
The most interesting for me, is the optimizations.
When GCC Compiles a C program, depending on the settings you choose, you can optimize for the end binary file size, or for speed. Surprisingly, Mozilla have optimized for size. I don’t see why you’d care if you firefox executable was 5MB or 10MB, but apparently, they do.
Mozilla uses gcc -O
I chose to use gcc -O3 and the speed improvements are quite obvious.
From a compiler perspective, speed optimizations include loop unrolling, as well as architecture specific SSE’s (among other things).
I wasn’t the first one to think of this, however.
If you’re running Windows Linux, you can download Swiftfox and those guys have done it for you. You just download the executable based on your CPU. They have versions optimized for AMD, Intel etc..
Also available is swiftweasel.
For those who don’t know the difference, despite being open source, firefox uses copyrighted images. Since certain linux distributions are against including anything that is not completely open and free some of them -namely debian, recompile the firefox source code, using only free artwork, and rename it iceweasel. So, on linux, you combine both situations. The free artwork, and the speed optimizations, giving you swiftfox.

I’m currently running Firefox 3.0 beta2, and the improvement is quite substantial, and I’ve yet to have it crash despite it being beta.
I’d recommend anyone using firefox try out one of the aforementioned optimized builds.