Hacker News new | ask | show | jobs
by pjmlp 3916 days ago
> Whenever a change is made, that is 7-10 seconds the watch command is running and I'm not testing my changes in the webapp.

Compared with C and C++ build times which are measured in minutes or even hours, 10s is nothing.

2 comments

I wasn't aware that C and C++ compilers were dog-slow. Is that because of the complexity of the language in the case of C++ compilers?
A lot of the bottleneck is the header structure: the size of the translation units (.c files with headers expanded transitively) is often quadratic with respect to overall codebase size.

If you fix that, then linking can take a long time too. (Not sure on the details, but it's a "global" algorithm to fix up all the pointer offsets)

Incremental builds will be slow if you structure your code in such a way that you often have to touch a header file, and that header file requires recompiling all translation units.

In short, you have to be super careful about structuring your code in C/C++ if you want fast build times, and approximately zero of the industrial codebases I've seen do this. (Well there was one, but it was all written by a single person, which is not surprising.)

Huh? My 100,000 lines of code takes seconds.
That also depends massively on the used libraries and the structure of the code. A 100kloc c file could build superfast. Whereas multiple c++ totalling about 10kloc that include use use lots of Boost stuff can take ages compared to that.
Try compiling a real big project, enterprise scale e.g. Linux kernel.