[llvm] r231028 - IndexedMap: Document why SmallVector<T, 0> is preferable here.

Benjamin Kramer benny.kra at googlemail.com
Mon Mar 2 14:20:22 PST 2015


Author: d0k
Date: Mon Mar  2 16:20:22 2015
New Revision: 231028

URL: http://llvm.org/viewvc/llvm-project?rev=231028&view=rev
Log:
IndexedMap: Document why SmallVector<T, 0> is preferable here.

Modified:
    llvm/trunk/include/llvm/ADT/IndexedMap.h

Modified: llvm/trunk/include/llvm/ADT/IndexedMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IndexedMap.h?rev=231028&r1=231027&r2=231028&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IndexedMap.h (original)
+++ llvm/trunk/include/llvm/ADT/IndexedMap.h Mon Mar  2 16:20:22 2015
@@ -30,6 +30,9 @@ namespace llvm {
 template <typename T, typename ToIndexT = llvm::identity<unsigned> >
   class IndexedMap {
     typedef typename ToIndexT::argument_type IndexT;
+    // Prefer SmallVector with zero inline storage over std::vector. IndexedMaps
+    // can grow very large and SmallVector grows more efficiently as long as T
+    // is trivially copyable.
     typedef SmallVector<T, 0> StorageT;
     StorageT storage_;
     T nullVal_;





More information about the llvm-commits mailing list