https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111976

--- Comment #1 from Mathias Stearn <redbeard0531 at gmail dot com> ---
Just to be clear, I think we should only do this for "large" objects or
collections of objects. If you did it for small objects in general, there is a
risk that they will spread out mutable data that is written to over more pages,
so that you end up with more runtime anonymous pages, rather than read-only
pages backed by the file cache, so they end up being more expensive. I think a
good rule to prevent this would be to only do it for objects larger than a
page, and possibly add page alignment to them. It may also be possible to
collect enough smaller objects together to make it worth doing this. Not sure
how often that occurs in practice though.

Also at -Os it may make sense to do this for any size object putting since
small objects in .bss will still shrink the binary size. Not sure how users of
-Os would react to tradeoffs involving runtime memory consumption vs binary
size.

Reply via email to