3 ms·
Any way to reasonably estimate how long it would take to compile back then? The PDP-11 was 1.25 MHz, Would it be roughly 4000x slower than compiling a 13K-line
by daxfohl 3y ago
Any way to reasonably estimate how long it would take to compile back then? The PDP-11 was 1.25 MHz, Would it be roughly 4000x slower than compiling a 13K-line C program on a modern CPU? Or are computer architectures so much different that CPU speed isn't the primary factor?
- hnfong 3y agoC compilers can be very fast. (See for example, https://bellard.org/tcc/tccboot.html https://bellard.org/tcc/tccboot.html ) If I'm not mistaken, much of the work when compiling code these days are optimizations.
- retrac 3y agoCompilers vary greatly in their complexity. In particular, optimization is a truly open-ended task, which can consume however much CPU time and memory as you're willing to throw at it. GCC and LLVM today are much more sophisticated than anything around in the 1970s or 1980s. They will chew up the entire program, transform it into an enormous (many megabyte or gigabyte) graph abstractly representing the program, and then spend hundreds of billions of cycles, exploring possible rewrites of this graph, that make the program faster or more efficient. In comparison, early compilers, including the first C compiler, usually worked on a single statement at a time, immediately translating it into equivalent machine code. It never examines the whole program together, as there wasn't enough RAM in those machines to do that. This produces inefficient code, but it's very fast to compile. In fact, accommodating the memory limits of machines like the PDP-11 influenced much of C's design. It's why everything has to be declared before use, for example. That way less state needs to be kept to resolve forward references.
- inkyoto 3y agoPeople did not compile the kernel back then. The kernel was supplied in a precompiled form as a collection of object (.o) files, and there was a kernel «generation» shell script that would ask questions about which parts of the kernel were required (e.g. which device drivers to link in), what to set certain kernel parameters to (e.g. the number and the size of I/O buffers for the page cache had not been invented yet and neither had been «sysctl»), and – after jumping through the hooves of the very detailed and thorough interview with the kernel generation script – it would link the /unix kernel a.out image. It took several hours to get the final product. The source code was distributed on a tape but it was not customary to compile the kernel from scratch every time.