rust-browser-game
rust-browser-game copied to clipboard
Enabling LTO (Link time optimizations) reduces binary size when using core abstractions
Adding to rustc options -C lto reduces the size from for example:
Using core clamp function: 559K
The same but with lto enabled: 5.8K
Also note that the actual size of the binary is: 3.8K
Maybe enabling lto allows you to use some core abstractions without bloating the binary. Hope it helps.
@cdecompilador I like how you purposefully not mention that the size increase from 3.8k to 3.9k without any code modifications just by enabling LTO Kappa
Sorry it wasn't on purpose, that happens because lto does some inlinings than even telling the compiler not to inline it does. I hope still the information is useful, for example you can use math functions without implement them by yourself and also tell the compiler to disable checkings on casting to reduce the code size even more.