Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are multiple reasons why the Go compiler is much faster than most C/C++ compilers:</p> <ul> <li><p><strong>Top reason</strong>: Most C/C++ compilers exhibit exceptionally bad designs (from compilation speed perspective). Also, from compilation speed perspective, some parts of the C/C++ ecosystem (such as editors in which programmers are writing their codes) aren't designed with speed-of-compilation in mind.</p></li> <li><p><strong>Top reason</strong>: Fast compilation speed was a conscious choice in the Go compiler and also in the Go language</p></li> <li><p>The Go compiler has a simpler optimizer than C/C++ compilers</p></li> <li><p>Unlike C++, Go has no templates and no inline functions. This means that Go doesn't need to perform any template or function instantiation.</p></li> <li><p>The Go compiler generates low-level assembly code sooner and the optimizer works on the assembly code, while in a typical C/C++ compiler the optimization passes work on an internal representation of the original source code. The extra overhead in the C/C++ compiler comes from the fact that the internal representation needs to be generated.</p></li> <li><p>Final linking (5l/6l/8l) of a Go program can be slower than linking a C/C++ program, because the Go compiler is going through all of the used assembly code and maybe it is also doing other extra actions that C/C++ linkers aren't doing</p></li> <li><p>Some C/C++ compilers (GCC) generate instructions in text form (to be passed to the assembler), while the Go compiler generates instructions in binary form. Extra work (but not much) needs to be done in order to transform the text into binary.</p></li> <li><p>The Go compiler targets only a small number of CPU architectures, while the GCC compiler targets a large number of CPUs</p></li> <li><p>Compilers which were designed with the goal of high compilation speed, such as Jikes, are fast. On a 2GHz CPU, Jikes can compile 20000+ lines of Java code per second (and the incremental mode of compilation is even more efficient).</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload