News for hackers. Stuff that matters.
Re:How to Adopt Modern C++17 into Your C++ Code [video] by cominous on Thursday May 10, 2018 @10:32AM (#17039152)
I used -Os as for any embedded code where I don't care too much about the performance and rather need a compact binary.

I would love to post my code snippets from back then, but Im not home currently and the time Im back home I guess nobody will care about this anymore :D. Maybe I put it into an article.

Re:How to Adopt Modern C++17 into Your C++ Code [video] by gpderetta on Thursday May 10, 2018 @11:09AM (#17039524)
If I had to guess, -Os prevents most inlining and in inlining is is pretty much required to remove most of the pure compile time abstraction and indirection that is used even on most trivial C++ libraries. Very likely libstdc++ make significant use of that.

The intermediate inline stages greatly expand the code size, until the point level where all the abstraction can be compiled away. I guess that -Os simply settles for a local optimum and gives up inlining early.

Re:How to Adopt Modern C++17 into Your C++ Code [video] by alexeiz on Thursday May 10, 2018 @03:18PM (#17042113)
-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.
Re:How to Adopt Modern C++17 into Your C++ Code [video] by msla on Thursday May 10, 2018 @04:44PM (#17042796)
In modern systems with caches and a typical penalty for going out to RAM, is it still possible for larger code to be faster?
Re:How to Adopt Modern C++17 into Your C++ Code [video] by gpderetta on Friday May 11, 2018 @05:42AM (#17045994)
Yes. 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).