[PATCH] D100744: Use SmallVector instead of std::vector to manage storage of llvm::BitVector

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 19 01:46:27 PDT 2021


serge-sans-paille created this revision.
serge-sans-paille added reviewers: nikic, thakis, dexonsmith.
serge-sans-paille requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is a follow-up to https://reviews.llvm.org/D100387.
`std::vector` is not the best storage container here. My local benchmark (counting the number of instruction when compiling the sqlite3 amalgametion) yields the following:

- `std::vector<BitVector>` -> 5,860,885,896
- `SmallVector<BitWord, 0>` -> 5,858,991,997
- `SmallVector<BitWord> -> 5,817,679,224


https://reviews.llvm.org/D100744

Files:
  llvm/include/llvm/ADT/BitVector.h


Index: llvm/include/llvm/ADT/BitVector.h
===================================================================
--- llvm/include/llvm/ADT/BitVector.h
+++ llvm/include/llvm/ADT/BitVector.h
@@ -79,7 +79,7 @@
   static_assert(BITWORD_SIZE == 64 || BITWORD_SIZE == 32,
                 "Unsupported word size");
 
-  using Storage = std::vector<BitWord>;
+  using Storage = SmallVector<BitWord>;
 
   Storage Bits;  // Actual bits.
   unsigned Size; // Size of bitvector in bits.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100744.338446.patch
Type: text/x-patch
Size: 473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210419/4c450768/attachment.bin>


More information about the llvm-commits mailing list