diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-09 05:20:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-09 05:20:45 +0000 |
commit | f1a3082513c94bc5ed2a6a3e2fb6cf9b9a8ac157 (patch) | |
tree | 5d6a7a754786dce4d6c5ffd5039d93c60a8df6c0 /docs/ProgrammersManual.html | |
parent | f6cec85a4b40094fc8fd5182d88cd01e92f12444 (diff) |
don't allow hash_map or hash_set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66400 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/ProgrammersManual.html')
-rw-r--r-- | docs/ProgrammersManual.html | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index cf46a97e68..47a982924c 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -1187,21 +1187,16 @@ factors, and produces a lot of malloc traffic. It should be avoided.</p> <p> The STL provides several other options, such as std::multiset and the various -"hash_set" like containers (whether from C++ TR1 or from the SGI library).</p> +"hash_set" like containers (whether from C++ TR1 or from the SGI library). We +never use hash_set and unordered_set because they are generally very expensive +(each insertion requires a malloc) and very non-portable. +</p> <p>std::multiset is useful if you're not interested in elimination of duplicates, but has all the drawbacks of std::set. A sorted vector (where you don't delete duplicate entries) or some other approach is almost always better.</p> -<p>The various hash_set implementations (exposed portably by -"llvm/ADT/hash_set") is a simple chained hashtable. This algorithm is as malloc -intensive as std::set (performing an allocation for each element inserted, -thus having really high constant factors) but (usually) provides O(1) -insertion/deletion of elements. This can be useful if your elements are large -(thus making the constant-factor cost relatively low) or if comparisons are -expensive. Element iteration does not visit elements in a useful order.</p> - </div> <!-- ======================================================================= --> @@ -1340,20 +1335,14 @@ another element takes place).</p> <p> The STL provides several other options, such as std::multimap and the various -"hash_map" like containers (whether from C++ TR1 or from the SGI library).</p> +"hash_map" like containers (whether from C++ TR1 or from the SGI library). We +never use hash_set and unordered_set because they are generally very expensive +(each insertion requires a malloc) and very non-portable.</p> <p>std::multimap is useful if you want to map a key to multiple values, but has all the drawbacks of std::map. A sorted vector or some other approach is almost always better.</p> -<p>The various hash_map implementations (exposed portably by -"llvm/ADT/hash_map") are simple chained hash tables. This algorithm is as -malloc intensive as std::map (performing an allocation for each element -inserted, thus having really high constant factors) but (usually) provides O(1) -insertion/deletion of elements. This can be useful if your elements are large -(thus making the constant-factor cost relatively low) or if comparisons are -expensive. Element iteration does not visit elements in a useful order.</p> - </div> <!-- ======================================================================= --> |