How fast does 8g in Google Go compile?

To get an idea how fast Google Go code can be compiled, I've compiled a big chunk of the Google Go library code with the default 8g compiler. Here are the results:
  • 90 8g compiler invocations
  • no linking
  • 21MB .8 object data generated
  • 89540 lines of .go source from goroot/src/pkg
  • 345305 words of .go source
  • 2.22MB of .go source
  • 17908 lines per second compilation speed
  • 3676757 .8 bytes per second compilation speed
  • 389473 source bytes per second compilation speed
  • average 5.7s real time
  • average 4.8s user time
  • average 0.9s system time
  • 3G RAM and Intel Core2 Duo CPU T5250 @ 1.50GHz

As a quick comparison, I've compiled Ruby 1.8.6 with gcc:

  • 38 invocations of gcc -s -O2 (GCC 4.2.4)
  • 38 .c files of Ruby 1.8.6 source code (without extensions)
  • 15 .h files
  • 1044075 bytes generated in .o files
  • 92543 source lines
  • 283554 source words
  • 2.15MB of source code
  • 62190 source bytes per second compilation speed
  • 27916 .o bytes per second compilation speed
  • 37.4s real time
  • 35.9s user time
  • 1.0s system time
  • 0.4626 .o bytes generated per source byte

What I see here is that 8g is 131 times faster than GCC if we count object bytes per second, and it is 6.26 times faster if we count source bytes per second. But we cannot learn much from these ratios, because not the same code was compiled. What is obvious is that Go object files are much larger than C object files (relative to their source files) in this experiment.

No comments: