Archive

Archive for the ‘Linus Torvalds’ Category

Linus Torvalds can build the whole linux kernel in about 16s

December 22nd, 2008
From: Linus Torvalds <torvalds-AT-linux-foundation.org>
To: “Craig L. Ching” <cching-AT-mqsoftware.com>
Subject: Re: Monotone workflow compared to Git workflow ( was RE: Git vs Monotone)
Date: Thu, 31 Jul 2008 14:40:55 -0700 (PDT)
Message-ID: <alpine.LFD.1.10.0807311426090.3277@nehalem.linux-foundation.org>
Cc: sverre-AT-rabbelier.nl, Git Mailinglist <git-AT-vger.kernel.org>
Archive-link: Article, Thread

On Thu, 31 Jul 2008, Linus Torvalds wrote:
>
> Sure, if you want to keep the build tree around, you would probably not
> use branches.

Side note: it's often faster to recompile, if your project has a good
build system.

For example, for the kernel, I can literally rebuild my whole kernel
(which is just what I use on _that_ machine) in about 16 seconds. This is
_not_ using ccache or anything else - it's rebuilding the whole tree with
-j16.

It turns out that using multiple build trees would actually slow things
down, because then the source code wouldn't fit in memory any more. If I
have to actually read the source code from the disk, my nice 16-second
compile goes up to a minute or more.

Now, the thing you should take away from this is:

 - kernel people have cool toys, and CPU's that are faster than what you
   have. Nyaah, nyaah.

 - disk is slow. REALLY slow. If you can share most of a single source
   tree and thus keep it in memory, you're ahead.

 - even large projects can have a fast build cycle if your build chain
   doesn't suck. The kernel is larger than most, but a _lot_ of build
   systems don't parallelize or use horribly inefficient tools, so they
   take much longer to build. 

The last part is the thing that people often stumble on. For example, I
can literally compile the kernel a hell of a lot faster than I can do
"make doc" on the git tree! Even just trying a "make -j16" when building
the git documentation is really really really painful. I suspect I'd need
a ton more memory for that horror.

So if your workflow involves xml (I think the doc build for git is all
xsltproc - along with asciidoc written in python or something), you're
screwed. But in the kernel we've actually cared pretty deeply about build
times, and as a result it's actually very pleasant to switch branches and
just rebuild. Even if some core header file has changed, it's _still_ ok
if you've got enough CPU.

(I just tested - I can do a "make doc" for git in just under a minute from
a clean tree. Ouch. That really is three times longer than my kernel
build - as long as I brought the kernel and compiler into memory first ;) 

			Linus

Linus Torvalds