DEV Community

Jitendra
Jitendra

Posted on

What makes Go's compiler so FAST?

One of the best features of Go is its extremely quick compiler.
However, what exactly did the Go team do to achieve this?
Why is the Go compiler so fast?
Here are the reasons.

Go is simple

  • Go only has 20-something keywords in the language.
  • Compared to Java in the 60s and close to 100 for C++, for example.
  • This helps with shortening the compilation time.

No unused components

  • You can't compile with unused components like variables or imports.
  • Your IDE or code editor will also constantly complain during your development.
  • This helps reduce unnecessary instructions to compile at the end.

No symbol table when parsing

  • A symbol table is a data structure for storing entities like variable/function names.
  • Parsing in languages like C/C++ requires the symbol table.
  • Note that the symbol table is still used for full compilation, just not during parsing in Go, which reduces part of compilation time. No header files.
  • C/C++ uses header files to connect the different components together.
  • These header files take extra time to load, parse then compile.
  • Go, on the other hand, doesn't use header files.

Prioritisation

  • Fast compilation speed has been the priority since the birth of Go.
  • As a result, other features of Go have to be designed with fast compilation in mind.
  • Such prioritisation makes a difference, especially over time.

Hope this helps you get some ideas on this subject!

Top comments (0)