doujiu7680 2015-08-20 22:07
浏览 234
已采纳

Go 1.5的自举编译器是否比用C语言编写的Go 1.4编译器慢?

Go 1.5 managed to release a bootstrapped compiler written in Go. Assuming Go is slower than C, and the earlier Go compiler is written in C, is the bootstrapped compiler going to be slower in compilation time?

  • 写回答

2条回答 默认 最新

  • duanlan7903 2015-08-20 23:57
    关注

    Yes, the Go 1.5 compiler is slower, as discussed in the release notes:

    Builds in Go 1.5 will be slower by a factor of about two. The automatic translation of the compiler and linker from C to Go resulted in unidiomatic Go code that performs poorly compared to well-written Go. Analysis tools and refactoring helped to improve the code, but much remains to be done. Further profiling and optimization will continue in Go 1.6 and future releases. For more details, see these slides and associated video.

    Again, the compiler was (initially) automatically translated, so after the translation it output the same code as before: your programs aren't slower because the compiler is. The rest of the release notes and the links above shed more light. There are considerations other than compile speeds involved: the authors intend to move faster in Go than they could in C.

    I'd recommend upgrading: open-source code will come to depend on 1.5, and if you stay behind you lose a lot of cool stuff, like big reductions in GC latency from pushing most of that work into the background (also discussed in the Performance section linked above; I wrote a bit more about it responding to another question).

    You should, as with any big upgrade, test to make sure that stuff like the new default of using all available cores, tweaks to scheduling, or any of the little library behavior changes don't bite you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog