6 ms·
-Os is pretty much useless. For comparison, I compiled my (reasonably sized) project with -Os and got a 12MB statically linked binary. But with -O3, the binar
by alexeiz 8y ago
-Os is pretty much useless. For comparison, I compiled my (reasonably sized) project with -Os and got a 12MB statically linked binary. But with -O3, the binary size is only 4.2MB. Not only -O3 produces faster code but it's also smaller.
- msla 8y agoIn modern systems with caches and a typical penalty for going out to RAM, is it still possible for larger code to be faster?
- gpderetta 8y agoYes. Caches actually work. And work quite well for code. Of course there are pathological cases. Also, static size does not mean anything. The only thing that matter is the dynamic size (i.e. the instructions that are actually fetched at runtime: code that isn't run or run rarely doesn't matter (then again, such code is a prime candidate to be compiled with -Os).