| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
原始链接: https://news.ycombinator.com/item?id=44027424
这篇 Hacker News 讨论串围绕链接时优化 (LTO) 展开,起因是一篇文章声称 LTO 是一种“新型”编译器优化技术。一些评论者,包括 D 语言的创造者 Walter Bright,指出 LTO 已经存在了几十年,早在 80 年代和 90 年代就已出现实现。讨论涉及目标文件生成的粒度,有人提倡每个类型生成一个目标文件以实现更细粒度的增量编译。其他评论者讨论了 LTO 的性能优势和劣势,包括构建时间增加、单核使用与多核使用,以及潜在的代码大小减小。还有人担心 LTO 会破坏依赖于特定编译器关于外部函数调用和对象生命周期假设的代码,尤其是在涉及内存清除或垃圾收集的场景中。总的来说,评论认为 LTO 虽然是一个强大的工具,但它并非新技术,需要仔细考虑其影响。
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I never tried to implement them, finding it easier and more effective for the compiler to simply compile all the source files at the same time.
The D compiler is designed to be able to build one object file per source file at a time, or one object file which combines all of the source files. Most people choose the one object file.
reply