Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There will always be applications for doing a fresh complete build. Like, searching for a bug in different code revisions. You're just not doing that if each compile takes 5 minutes.

As a baseline, a non optimizing compiler for a simple language should be able to do 1 million lines of code per second. Of course, most languages are not simple.

Incremental compilation is an essential operation. I probably do it more than 100 times a day. Just like editor responsiveness, it can almost not be fast enough, and if it takes too long it can bring me out of the flow. I would say that over 0.1 seconds any speed improvement is welcome. More than 3 seconds is definitely a nuisance. More than 15 seconds is extremely frustrating when dealing with certain kinds of code.



> You're just not doing that if each compile takes 5 minutes.

I've bisected large codebases for bugs several times where compiles take hours.


Yeah but I bet you wished it took less time.


I'm curious, are there any 1 million LoC projects out there that compile in under a second?


Sure. TCC (the tiny C compiler) runs at over 3 million LoC/s on my machine (on a single core!) and GCC debug builds aren't that far behind, so for C (or very orthodox C++) projects it's doable. I keep my own C++ codebases under an arbitrary target of 10s for fully optimized release builds and over half of that is wasted by the NVCC.


Are there any 1 million LoC codebases compatible with TCC that can be run in under a second with it?

I ask because there's various unexpected things that can make large codebases compile more slowly out in the wild that don't show up in smaller codebases (as well as non-linear scaling of certain components), often making simple extrapolation of how quickly a smaller codebase compiles to a larger one inaccurate.

One million lines is a good if arbitrary point where a lot of those can be sussed out.


I don't know the answer to your question, but with regards to the million LoC/s target it's worth noting that an AMD 3970X can compile the Linux kernel in under 24 seconds [1] (that's an optimized GCC release build), which is around 28 million LoC. Even though I'm sure conditional compilation will cut some of it out, it's close enough to be in the ballpark.

[1] https://www.phoronix.com/scan.php?page=article&item=amd-linu...


I don't have concrete numbers but I keep hearing OCaml's compiler is extremely fast.


Even when bisecting you can still reuse the built dependencies, at least if you're using sccache.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: