diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2007-09-24 17:52:25 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@dberlin.org> | 2007-09-24 17:52:25 +0000 |
commit | 7ea44dc6279fb767b74dc1edbf6cf5a0ac36f53b (patch) | |
tree | 6e8f7f2f7a79d0b0ad0b3ad28c1eade65b4dd0f5 /docs/ProgrammersManual.html | |
parent | e410b7424c3d74452a1b8d4fd0bd4e6c126724be (diff) | |
download | external_llvm-7ea44dc6279fb767b74dc1edbf6cf5a0ac36f53b.zip external_llvm-7ea44dc6279fb767b74dc1edbf6cf5a0ac36f53b.tar.gz external_llvm-7ea44dc6279fb767b74dc1edbf6cf5a0ac36f53b.tar.bz2 |
Add section on bit containers.
(Not the most well written stuff in the universe :P)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42267 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/ProgrammersManual.html')
-rw-r--r-- | docs/ProgrammersManual.html | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index a9daba3..795b91a 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -77,6 +77,11 @@ option</a></li> <li><a href="#dss_map"><map></a></li> <li><a href="#dss_othermap">Other Map-Like Container Options</a></li> </ul></li> + <li><a href="#ds_bit">BitVector-like containers</a> + <ul> + <li><a href="#dss_bitvector">A dense bitvector</a></li> + <li><a href="#dss_sparsebitvector">A sparse bitvector</a></li> + </ul></li> </ul> </li> <li><a href="#common">Helpful Hints for Common Operations</a> @@ -705,6 +710,11 @@ access the container. Based on that, you should use:</p> iteration, but do not support efficient look-up based on a key. </li> +<li>a <a href="#ds_bit">bit</a> container provides an efficient way to store and + perform set operations on sets of numeric id's, while automatically + eliminating duplicates. Bit containers require a maximum of 1 bit for each + identifier you want to store. +</li> </ul> <p> @@ -1276,6 +1286,45 @@ expensive. Element iteration does not visit elements in a useful order.</p> </div> +<!-- ======================================================================= --> +<div class="doc_subsection"> + <a name="ds_bit">Bit storage containers (BitVector, SparseBitVector)</a> +</div> + +<div class="doc_text"> +Unlike the other containers, there are only two bit storage containers, and when +to use each is relatively straightforward. +</div> + +<!-- _______________________________________________________________________ --> +<div class="doc_subsubsection"> + <a name="dss_bitvector">BitVector</a> +</div> + +<div class="doc_text"> +<p> The BitVector container provides a fixed size set of bits for manipulation. +It supports individual bit setting/testing, as well as set operations. The set +operations take time O(size of bitvector), but operations are performed one word +at a time, instead of one bit at a time. This makes the BitVector very fast for +set operations compared to other containers. Use the BitVector when you expect +the number of set bits to be high (IE a dense set). +</p> +</div> + +<!-- _______________________________________________________________________ --> +<div class="doc_subsubsection"> + <a name="dss_sparsebitvector">SparseBitVector</a> +</div> + +<div class="doc_text"> +<p> The SparseBitVector container is much like BitVector, with one major +difference: Only the bits that are set, are stored. This makes the +SparseBitVector much more space efficient than BitVector when the set is sparse, +as well as making set operations O(number of set bits) instead of O(size of +universe). The downside to the SparseBitVector is that setting and testing of random bits is O(N), and on large SparseBitVectors, this can be slower than BitVector. In our implementation, setting or testing bits in sorted order +(either forwards or reverse) is O(1) worst case. Testing and setting bits within 128 bits (depends on size) of the current bit is also O(1). As a general statement, testing/setting bits in a SparseBitVector is O(distance away from last set bit). +</p> +</div> <!-- *********************************************************************** --> <div class="doc_section"> |