in the bad old days compiling even a largish college project in Java on my old, slow machine could take tens of seconds. But nowadays machines are getting faster, RAM is abundant, the multiple processors are probably relatively easy to exploit for compiler work and so forth. So how fast are these things now? How long does it take to compile a project with 100K lines? Or how about an operating system with a few millions of them? For simplicity lets assume compile from scratch, without the precompiled dll and similar modules that would have speeded up the process.
We make an industrial control system that includes everything from fancy operator consoles and alarming systems to the controllers themselves, which contain their own proprietary operating system. In the “good ol’ days” it took an entire weekend to build it all. Just the controller part took 8 hours. Now on my desktop PC I can build all of the controller code in a few minutes (which includes the controller’s OS). It takes a couple of hours or so to build the entire system.
It’s about 100 MB of source for the controller, and about 800 MB of source for the entire system.
This depends entirely on the language, compiler, and even what features of the language you use:
A large, template-heavy C++ project, where a lot of work is being done at compile time (templates are a Turing-complete language in and of themselves, and they get executed entirely at compile time), will bog the computer down for hours. A C project with light optimizations will just fly by, because C compilers don’t (can’t, really) do nearly as much work as C++ compilers.
Python projects get compiled really fast, so fast that they’re typically compiled on-demand (that is, if the module is loaded and the system notices there’s no compiled version, the file will be compiled right then and the compiled version written to disk) with little appreciable lag. ColorForth does this as well, only moreso: I don’t think binaries are ever saved, except for the core system. Needless to say, neither Python nor ColorForth (or any Forth dialect) do much in the way of complex compile-time analysis of the code.
Some of the longest builds I’ve ever experienced are Stalin compiling a Scheme program to C. The reason is that Stalin does a hell of a lot of analysis, and it produces C that would induce madness if gazed upon by human eyes. Tight code and fast runtimes when it’s all compiled, but you pay for that in the build times.
In general: Optimizations take time. Some languages will take time even if they aren’t being optimized much. Different compilers run at different speeds (tcc is much faster than gcc at compiling C, but it produces worse code) and, of course, producing a high-level bytecode is typically faster than generating machine code.
Many projects I have worked on have had compile times approaching an hour.
I have used things like Incredibuild and SN-DBS to use parallism to try get back to vaguely sane build times.
Here’s what I see from the primary project I work on, on my laptop, building from an encrypted disk image:
$ (find . -name \*.java -exec cat {} \; ) | wc -l
417124
$ ant clean; time ant
[javac] Compiling 1700 source files
BUILD SUCCESSFUL
Total time: 42 seconds
real 0m43.393s
user 0m40.483s
sys 0m11.575s
And on my 8-core workstation:
Total time: 18 seconds
real 0m18.869s
user 0m37.693s
sys 0m3.998s
Doing a full runtime build of our product takes about 5 minutes, including obfuscating the bytecode and building packages for MacOS and Windows. (It includes 5 more projects, but none are nearly as large as the one shown above. We have an overseas development office that has access to our main codebase, but some more sensitive bits are kept much more restricted.) If it took much more time than than that, I’d get quite peeved. I’m the build-meister (among other things), and I have the whole build process well pipelined and multithreaded. It’s really not too bad - we often will run dozens of builds a day, and everything is totally tracked and reproducible.
Here are compile times for several large Linux programs from some Gentoo users. I tried Gentoo when it first came out and spent about a day compiling it. I’ve used only Slackware for years and, after the initial install, still build everything from source but very rarely spend more than a few minutes compiling. I know that doesn’t answer the question, unless you wanted to know how much time the average person who likes to compile has to spend on desktop programs.
Oh, boo hoo!
When I started in programming, we thought were lucky to get 2 compile runs in a single day. Sometimes we worked a split shift, came in early to submit a compile, took a 4-hour break for lunch & errands, and then worked into the evening to get a second compile in the same day.
Then we got a RJE terminal, and we could get a compile run every hour or two! Eventually we got online 3270 terminals (1 per 8 programmers in a terminal room, than 1 shared between the 2 programmers in each office, then eventually each of us had our own terminal) and enough TSO slots that nearly half of us could be online at once – then you could run a compile, check the output, and submit another compile, all within a few minutes.
I’ve done some COBOL programming on PC’s – it seems like heaven to do a compile anytime you want, and so fast – you can’t even get a cup of coffee before the compile is done. Almost no point in desk checking.
True. But generally while doing most programming/testing, the optimization is not needed. Usually you will turn that off, until you have a basically-working & tested program, and then optimize it. (Why optimize an incorrect program?)
In the real bad old days, Java didn’t even exist!
But even way back then, we had learned that a 100K line program was a bad idea. Projects were designed as a system of independent modules, that worked together, but were compiled separately. (Back in 1969, IBM’s ACP operating system had a limit of 4K on the size of a program module.) That was on machines with far less power than your cellphone or digital watch now. So if you are seeing programs that take hours to compile on current machines, you are seeing a really poor design!