3 ms·
> Compiler optimization reduces code size Nope, much is gained by unrolling loops, inlining functions etc, which all increase code size. Of course C++ compila
by jerrre 9y ago
> Compiler optimization reduces code size
Nope, much is gained by unrolling loops, inlining functions etc, which all increase code size.
Of course C++ compilation with no optimization at all can be rather wasteful with performance and code size, but to squeeze the final performance out you probably need to sacrifice code size (whether manual or automatic)
- aidenn0 9y ago> Nope, much is gained by unrolling loops, inlining functions etc, which all increase code size. That's because those are performance optimizations, not size optimizations (though as an aside, inlining functions can reduce code size in the event that the inlined version is smaller than the function-call overhead, or in the case where the function is used only once). There are plenty of size optimizations that can be performed. -Os will enable them on gcc/clang if you want to try for yourself.