Skip to content
Latchkey

What Is Link-Time Optimization?

Link-time optimization, or LTO, is a compiler technique that postpones some optimization to the linking stage so the toolchain can see the whole program rather than one file at a time. This enables cross-module inlining and dead-code elimination that per-file compilation cannot do. The result is often a faster, smaller binary.

Why it matters

Optimizing each translation unit in isolation misses opportunities that only appear when the whole program is visible, and LTO recovers them. The cost is a heavier, slower link step that can dominate build time. Teams often enable full LTO only for release builds and keep CI builds lighter to protect build minutes.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →