Hacker News new | ask | show | jobs
by candiodari 3505 days ago
The 10.000 foot view is that C code is optimized more, but compiles slower.

Historically this was always seen as a good tradeoff. You only compile once, but code runs thousands of times or more. Therefore a large slowdown in compilation is seen as a good tradeoff for better runtime speed.

Go follows the turbo pascal type compilers in that

1) the language is limited in several ways to make compilation faster (e.g. it is given as an argument against generics)

2) the compiler just doesn't try a whole range of optimizations

Unfortunately this is not really what you're seeing. What you're seeing in this case is a massive difference in the size of the projects you're compiling.

Go has been written with the explicit purpose of making writing large programs somewhere between tedious and impossible. By contrast, many C/C++ programs are huge. Tens to hundreds of megabytes of source code, and when compiling Gentoo, I bet you're compiling more than a gigabyte total.

1 comments

Very insightful. Thanks!