[llvm-commits] CVS: llvm/docs/ProgrammersManual.html
Chris Lattner
sabre at nondot.org
Sat Feb 3 16:00:42 PST 2007
Changes in directory llvm/docs:
ProgrammersManual.html updated: 1.119 -> 1.120
---
Log message:
describe SmallSetVector
---
Diffs of the changes: (+14 -5)
ProgrammersManual.html | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
Index: llvm/docs/ProgrammersManual.html
diff -u llvm/docs/ProgrammersManual.html:1.119 llvm/docs/ProgrammersManual.html:1.120
--- llvm/docs/ProgrammersManual.html:1.119 Sat Feb 3 16:04:27 2007
+++ llvm/docs/ProgrammersManual.html Sat Feb 3 18:00:26 2007
@@ -1016,8 +1016,9 @@
</div>
<div class="doc_text">
-<p>LLVM's SetVector<Type> is actually a combination of a set along with
-a <a href="#ds_sequential">Sequential Container</a>. The important property
+<p>LLVM's SetVector<Type> 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 @@
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 @@
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>
<!-- _______________________________________________________________________ -->
@@ -3161,7 +3170,7 @@
<a href="mailto:dhurjati at cs.uiuc.edu">Dinakar Dhurjati</a> and
<a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2007/02/03 22:04:27 $
+ Last modified: $Date: 2007/02/04 00:00:26 $
</address>
</body>
More information about the llvm-commits
mailing list