describe SmallSetVector
authorChris Lattner <sabre@nondot.org>
Sun, 4 Feb 2007 00:00:26 +0000 (00:00 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Feb 2007 00:00:26 +0000 (00:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33847 91177308-0d34-0410-b5e6-96231b3b80d8

docs/ProgrammersManual.html

index 8e61b179f0e8aa1c7ffa3a3911f9690f514ce31c..1d5ad0e82c0d8319fa5dea47da7e8f80c5f5ee46 100644 (file)
@@ -1016,8 +1016,9 @@ std::set is almost never a good choice.</p>
 </div>
 
 <div class="doc_text">
-<p>LLVM's SetVector&lt;Type&gt; is actually a combination of a set along with
-a <a href="#ds_sequential">Sequential Container</a>.  The important property
+<p>LLVM's SetVector&lt;Type&gt; is an adapter class that combines your choice of
+a set-like container along with a <a href="#ds_sequential">Sequential 
+Container</a>.  The important property
 that this provides is efficient insertion with uniquing (duplicate elements are
 ignored) with iteration support.  It implements this by inserting elements into
 both a set-like container and the sequential container, using the set-like
@@ -1028,7 +1029,7 @@ container for uniquing and the sequential container for iteration.
 iteration is guaranteed to match the order of insertion into the SetVector.
 This property is really important for things like sets of pointers.  Because
 pointer values are non-deterministic (e.g. vary across runs of the program on
-different machines), iterating over the pointers in a std::set or other set will
+different machines), iterating over the pointers in the set will
 not be in a well-defined order.</p>
 
 <p>
@@ -1036,9 +1037,17 @@ The drawback of SetVector is that it requires twice as much space as a normal
 set and has the sum of constant factors from the set-like container and the 
 sequential container that it uses.  Use it *only* if you need to iterate over 
 the elements in a deterministic order.  SetVector is also expensive to delete
-elements out of (linear time).
+elements out of (linear time), unless you use it's "pop_back" method, which is
+faster.
 </p>
 
+<p>SetVector is an adapter class that defaults to using std::vector and std::set
+for the underlying containers, so it is quite expensive.  However,
+<tt>"llvm/ADT/SetVector.h"</tt> also provides a SmallSetVector class, which
+defaults to using a SmallVector and SmallSet of a specified size.  If you use
+this, and if your sets are dynamically smaller than N, you will save a lot of 
+heap traffic.</p>
+
 </div>
 
 <!-- _______________________________________________________________________ -->