Reduce size of Option class from 184 bytes to 136 bytes by
placing more member variables in Bit Field (16 bytes), and
reducing the initial sizes of Categories and Subs to 1 (32 bytes).
Saves about 48k for bin/opt.
Differential D62091
[CommandLine] Reduce size of Option class hintonda on May 17 2019, 5:38 PM. Authored by
Details Reduce size of Option class from 184 bytes to 136 bytes by Saves about 48k for bin/opt.
Diff Detail
Event TimelineComment Actions This is pretty cool. Since these are usually allocated as globals, this is saving pages of dirtied memory. One implementation thought. What if we group the 16-bit fields together and make them uint16_t then use a uint16_t as the bitfield type for the remaining 15 bits. The performance of the 16-bit fields should be better if they are aligned (not that cl::opt perf really matters). Comment Actions I tried to keep the relative order as close to the original as possible, but after rereading your comment, I'm unsure if you wanted me to group the non-bit field unit16_t's together as well. Please let me know... Comment Actions The main thing is to make sure that if you have proper integer sized members they are properly aligned and packed, which this seems to do well.
|