Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Every few years I try LTO on our game engine (about 1M LOC C++) and either the resulting binary crashes or isn't measurably faster.

Invariably, though, the executable is at least a few MB larger (a bad trade on systems like the Nintendo Switch where memory is scarce) and the incremental build time is intolerable.

I've always wondered why it's never brought the promised free performance; I can only assume our frequent profiling and judicious definition of hot functions inline has gotten us almost everything LTO would bring anyway.



LLVM's thin LTO should at least not make your build times (much) longer. Have you tried that?


Yes, IIRC it took a few minutes to turn around an incremental build (instead of maybe 10 seconds) and 2MB bigger text segment for no measurable performance gains.


Interesting, thanks!

For our (Rust) project, thin LTO doesn't cost much extra in compile time and gives a few percent speedup. But it's not a terribly optimized code base, and we don't have any manual inline annotations etc.


The crashes sound like added value; LTO has exposed bugs in your code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: