[PATCH] D68586: Save a word in every StringSet entry

Jordan Rose via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 11:40:26 PDT 2019


jordan_rose created this revision.
jordan_rose added reviewers: mmpozulp, aaron.ballman.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.

Add a specialization to StringMap (actually StringMapEntry) for a value type of NoneType (the type of llvm::None), and use it for StringSet. This'll save us a word from every entry in a StringSet, used for alignment with the size_t that stores the string length.

I could have gone all the way to some kind of empty base class optimization <https://en.cppreference.com/w/cpp/language/ebo>, but that seemed like overkill.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68586

Files:
  llvm/include/llvm/ADT/StringMap.h
  llvm/include/llvm/ADT/StringSet.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68586.223632.patch
Type: text/x-patch
Size: 4338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191007/28a90f60/attachment.bin>


More information about the llvm-commits mailing list