3 ms·
Have you ever tried to build Chromium or Firefox yourself? If you have a slow machine, the build can take even 10 hours or more
by mister_hn 7y ago
Have you ever tried to build Chromium or Firefox yourself? If you have a slow machine, the build can take even 10 hours or more
- _ph_ 7y agoNo, I have not. But wouldn't be those code bases which compile very slow because of being written in C++? C++ seems to baloon in building time for large code bases. On the other side, the big Threadripper manages to compile the Linux Kernel in 40s. I don't think those web browsers are that much bigger than Linux than the compile times differ. Firefox is further slowed down by using more and more Rust based code - Rust is known to compile slowly. However I would say this is a good tradeoff, since Rust brings much more safety to one of the most safety-critical applications on a typical desktop.
- rhoyerboat 7y agothe general issue is that the feature rich web browser contains libraries wrapped around basically every leaf and stem of windows, mac and *nix desktop interface family forests. (if your building on say, a completely fresh stage3 gentoo system, that equals some pretty good linker load. cairo comes to mind as a huge culprit, whether its webkit or mozilla.)
- zlynx 7y agoIt is extremely easy to let your C++ code get into long build times. People get fond of putting code into the header, for example. This adds that compile time to every file that includes that file. And it prevents you from using forward declaration, which then requires including those definitions in your header. With discipline and tracking the build time, and tools that record how long each build step takes, you can keep people from doing things like declaring a Boost multimap in a header file. They can go ahead and use it but hide it in a cpp source file behind a pointer or a virtual interface. I've noticed that some people fall in love with C++11 move constructors, and they are pretty cool, but unlike a reference or pointer they require full type definitions in order to pass "by value." So that's annoying. C code is definitely faster to build, unless you've got some crazy programmer who reimplemented C++ templates using five level deep nested macros.
- jbverschoor 7y agoThen maybe they don't have proper dependencies set. Inclusing too many things, too many acessible stuff, globals, no libraries?
- cozzyd 7y agoDoesn't Firefox use -flto? That might be why.
- thechao 7y agoFast builds for C++ require unending diligence from day 1. Part of my team’s CI is a build time check. Our code base runs to 10mm lines of code; clean uncached builds are 3m; cached builds are 30s; incremental builds are in the 100s of ms range. The entire system is a single, short Makefile combined with ccache. There’s no fine-grain dependency tracking, so our builds never go wrong.