Hacker News new | ask | show | jobs
by jleahy 1712 days ago
It’s a shame that Osize can sometimes produce truly awful code. There are a few optimisations in there that trade a byte for a massive slowdown.
2 comments

You asked for minimum size, and that's what you got. I'd say that's working as it should.

A more granular control over optimisation would be good, however.

Probably just some tweaks to O2 would be enough, after all people are selecting Os over O2 because they see better performance, and that should not be happening.
You can enable/disable individual optimizations. How much more granular do you need?
Surely a profile-guided build should be able to only apply -Os to those functions where it doesn't cause a lot of problems.
In the application I referred to, PGO was also used. However, that only applies -Os to cold code, and if what you're doing is very branchy, it can help even in the hot path.