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

标签 go compiler-construction programming-languages

Go 1.5 成功发布了一个用 Go 编写的自举编译器。 假设 Go 比 C 慢,并且早期的 Go 编译器是用 C 编写的,那么自举编译器的编译时间是否会更慢?

最佳答案

是的,Go 1.5 编译器更慢,因为 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.

同样,编译器(最初)是自动翻译的,因此在翻译之后它输出与以前相同的代码:您的程序并不因为编译器变慢了。 The rest of the release notes上面的链接提供了更多信息。除了编译速度之外,还有其他考虑因素:作者打算在 Go 中比在 C 中更快地移动。

我建议升级:开源代码将依赖于 1.5,如果你落后你会失去很多很酷的东西,比如通过将大部分工作推到后台来大幅减少 GC 延迟(还有在上面链接的性能部分中讨论过;我写了更多关于它的内容 responding to another question )。

与任何重大升级一样,您应该进行测试以确保使用所有可用内核的新默认设置、调度调整或任何小的 library behavior changes别咬你。

关于go - Go 1.5 的自举编译器是否比用 C 编写的 Go 1.4 编译器慢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32129220/

相关文章:

go - Uber Zap 记录器不在日志语句中打印调用者信息

ios - XCode 5 像 CMATH 这样的编译库

programming-languages - 编写尽可能长的循环

linux - 学习Perl的建议?

Go (golang) 中的 MongoDB 与 mgo : how to use logical operators to query?

go - Web 服务器和同时监听 nats

c - 在哪里可以找到 C90 和 C99 的显式语法?

parsing - 生产编译器是否使用解析器生成器?

c++ - 什么时候应该使用模板,什么时候重载函数?

go - 等效结构上字段的接口(interface)转换