ridiculous amounts of padding

John Wehle john@feith.com
Sun Jan 31 23:58:00 GMT 1999


> glibc has very aggressively optimized string functions, that do tricks like
> that.  They do not appear to require more than 8 byte alignment on x86.  I'm
> not sure about other platforms.

I implemented CONSTANT_ALIGNMENT following the recommendations of the
"Intel Architecture Optimization Manual" that objects over a certain
size should be aligned on 32 byte boundaries in order to reduce the
number of cache lines.

> For the case that prompted the question (cpplib.c:print_help()) we emit 4468
> bytes of string constants and 1228 bytes of padding.  That's a 27.5% space
> increase.

It's certainly worth considering having this type of thing controlled by
-Os.  Many of the alignments done for performance result in an increase
in size which may be undesirable in some situations.  BTW, in all fairness
I would be surprised if the 27.5% space increase is representative of the
total size change that the final executable experienced due to extra
alignment.

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



More information about the Gcc mailing list