Page MenuHomePhabricator

[CommandLine] Move categories out of Option and into parser [NFC]
Needs ReviewPublic

Authored by hintonda on Dec 12 2019, 2:48 PM.

Details

Summary

This change reduces the size of each Option by only storing category
info that's actually used in the global parser. Saves 24 bytes per
Option.

Event Timeline

hintonda created this revision.Dec 12 2019, 2:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2019, 2:48 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
hintonda retitled this revision from [CommandLine] Move categories out of Option and into parser [NFC} to [CommandLine] Move categories out of Option and into parser [NFC].Dec 12 2019, 2:57 PM
MaskRay added a comment.EditedDec 16 2019, 9:44 PM

I recall that you have a patch that touched this area, which was committed and reverted for several times. Is this patch a similar one? Can you find pointers to the old one?

Have you tried TinyPtrVector?

I recall that you have a patch that touched this area, which was committed and reverted for several times. Is this patch a similar one? Can you find pointers to the old one?

Yes, the previous patch, D62105, attempted to move both SubCommands and Categories at the same time, but was overly complicated. I finally abandoned it after I was unable to reproduce a buildbot failure. This patch is similar, but only moves Categories and is much simpler.

Have you tried TinyPtrVector?

No, but I'll take a look tonight -- probably a better option than SmallPtrSet, especially since it's per Option, and we don't need to worry about dups in that context.