Page MenuHomePhabricator

ADT: Use EBO to shrink SmallVector size 1

Authored by dexonsmith on Jun 22 2018, 8:54 PM.



SmallVectorStorage is empty when its size is 1; use inheritance so that the empty base class optimization kicks in, saving a pointer for small SmallVectors.

I assume all compilers support this so the static_assert is valid... or should I only assert under some feature flag?

Diff Detail

Event Timeline

dexonsmith created this revision.Jun 22 2018, 8:54 PM
rnk accepted this revision.Jun 23 2018, 9:46 AM

Thanks for finding that!

This revision is now accepted and ready to land.Jun 23 2018, 9:46 AM
xbolva00 accepted this revision.Jun 23 2018, 10:36 AM
xbolva00 added a subscriber: xbolva00.

Looks fine

dexonsmith closed this revision.Jun 23 2018, 11:49 AM

Committed in r335421.