| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <head> |
| <meta name="generator" content="HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" /> |
| <title>Tree Text Find Timing Test</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> |
| </head> |
| <body> |
| <div id="page"> |
| <h1>Tree-Based and Trie-Based Text <tt>find</tt> Find Timing |
| Test</h1> |
| <h2><a name="description" id="description">Description</a></h2> |
| <p>This test inserts a number of values with keys from an |
| arbitrary text ([<a href="references.html#wickland96thirty">wickland96thirty</a>]) into |
| a container, then performs a series of finds using |
| <tt>find</tt>. It measures the average time for <tt>find</tt> |
| as a function of the number of values inserted.</p> |
| <p>(The test was executed with <a href="../../../../testsuite/performance/ext/pb_ds/text_find_timing.cc"><tt>text_find_timing_test</tt></a> |
| thirty_years_among_the_dead_preproc.txt 200 200 2100)</p> |
| <h2><a name="purpose" id="purpose">Purpose</a></h2> |
| <p>The test checks the effect of different underlying |
| data structures.</p> |
| <h2><a name="results" id="results">Results</a></h2> |
| <p>Figures <a href="#NTTG">NTTG</a>, <a href="#NTTM">NTTM</a>, |
| and <a href="#NTTG">NTTL</a> show the results for the native, |
| tree-based, and trie-based types in <a href="assoc_performance_tests.html#gcc"><u>g++</u></a>, <a href="assoc_performance_tests.html#local"><u>local</u></a>, and |
| <a href="assoc_performance_tests.html#local"><u>local</u></a>, |
| respectively.</p> |
| <div id="NTTG_res_div"> |
| <div id="NTTG_gcc"> |
| <div id="NTTG_random_int_find_find_timing_test_tree"> |
| <div id="NTTG_assoc"> |
| <div id="NTTG_Native_456_tree-based_456_random_int_find_timing_test_using__tt_find_455tt_"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NTTG" id="NTTG"><img src="random_int_find_find_timing_test_tree_gcc.png" alt="no image" /></a></h6>NTTG: Native, tree-based, random int find timing test using <tt>find</tt> - <a href="assoc_performance_tests.html#gcc">g++</a><p>In the above figure, the names in the legends have the following meaning:</p> |
| <ol> |
| <li> |
| splay_tree_map- |
| <a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag</tt> = <a href="splay_tree_tag.html"><tt>splay_tree_tag</tt></a> |
| , and <tt>Node_Update</tt> = <a href="null_tree_node_update.html"><tt>null_tree_node_update</tt></a> |
| </li> |
| <li> |
| ov_tree_map- |
| <a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag</tt> = <a href="ov_tree_tag.html"><tt>ov_tree_tag</tt></a> |
| , and <tt>Node_Update</tt> = <a href="null_tree_node_update.html"><tt>null_tree_node_update</tt></a> |
| </li> |
| <li> |
| n_map- |
| <tt>std::map</tt></li> |
| <li> |
| rb_tree_map- |
| <a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag</tt> = <a href="rb_tree_tag.html"><tt>rb_tree_tag</tt></a> |
| , and <tt>Node_Update</tt> = <a href="null_tree_node_update.html"><tt>null_tree_node_update</tt></a> |
| </li> |
| </ol> |
| </div><div style="width: 100%; height: 20px"></div></div> |
| </div> |
| </div> |
| <div id="NTTM_res_div"> |
| <div id="NTTM_msvc"> |
| <div id="NTTM_random_int_find_find_timing_test_tree"> |
| <div id="NTTM_assoc"> |
| <div id="NTTM_Native_456_tree-based_456_random_int_find_timing_test_using__tt_find_455tt_"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NTTM" id="NTTM"><img src="random_int_find_find_timing_test_tree_msvc.png" alt="no image" /></a></h6>NTTM: Native, tree-based, random int find timing test using <tt>find</tt> - <a href="assoc_performance_tests.html#msvc">msvc++</a><p>In the above figure, the names in the legends have the following meaning:</p> |
| <ol> |
| <li> |
| splay_tree_map- |
| <a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag</tt> = <a href="splay_tree_tag.html"><tt>splay_tree_tag</tt></a> |
| , and <tt>Node_Update</tt> = <a href="null_tree_node_update.html"><tt>null_tree_node_update</tt></a> |
| </li> |
| <li> |
| ov_tree_map- |
| <a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag</tt> = <a href="ov_tree_tag.html"><tt>ov_tree_tag</tt></a> |
| , and <tt>Node_Update</tt> = <a href="null_tree_node_update.html"><tt>null_tree_node_update</tt></a> |
| </li> |
| <li> |
| n_map- |
| <tt>std::map</tt></li> |
| <li> |
| rb_tree_map- |
| <a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag</tt> = <a href="rb_tree_tag.html"><tt>rb_tree_tag</tt></a> |
| , and <tt>Node_Update</tt> = <a href="null_tree_node_update.html"><tt>null_tree_node_update</tt></a> |
| </li> |
| </ol> |
| </div><div style="width: 100%; height: 20px"></div></div> |
| </div> |
| </div> |
| <div id="NTTL_res_div"> |
| <div id="NTTL_local"> |
| <div id="NTTL_random_int_find_find_timing_test_tree"> |
| <div id="NTTL_assoc"> |
| <div id="NTTL_Native_456_tree-based_456_random_int_find_timing_test_using__tt_find_455tt_"><div style = "border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NTTL" id= "NTTL"><img src="random_int_find_find_timing_test_tree_local.png" alt="no image" /></a></h6>NTTL: Native, tree-based, random int find timing test using <tt>find</tt> - <a href = "assoc_performance_tests.html#local">local</a></div><div style = "width: 100%; height: 20px"></div></div> |
| </div> |
| </div> |
| <h2><a name="observations" id="observations">Observations</a></h2> |
| <p>For this setting, a splay tree (<a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag =</tt> <a href="splay_tree_tag.html"><tt>splay_tree_tag</tt></a>) |
| does not do well. This is possibly due to two |
| reasons:</p> |
| <ol> |
| <li>A splay tree is not guaranteed to be balanced |
| [<a href="references.html#motwani95random">motwani95random</a>]. |
| If a splay tree contains <i>n</i> nodes, its |
| average root-leaf path can be <i>m >> |
| log(n)</i>.</li> |
| <li>Assume a specific root-leaf search path has |
| length <i>m</i>, and the search-target node has |
| distance <i>m'</i> from the root. A red-black |
| tree will require <i>m + 1</i> comparisons to |
| find the required node; a splay tree will require |
| <i>2 m'</i> comparisons. A splay tree, |
| consequently, can perform many more comparisons |
| than a red-black tree.</li> |
| </ol> |
| <p>An ordered-vector tree (<a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag =</tt> <a href="ov_tree_tag.html"><tt>ov_tree_tag</tt></a>), |
| a red-black tree (<a href="tree.html"><tt>tree</tt></a> |
| with <tt>Tag =</tt> <a href="splay_tree_tag.html"><tt>rb_tree_tag</tt></a>), |
| and the native red-black tree all share |
| approximately the same performance.</p> |
| <p>An ordered-vector tree is slightly slower than |
| red-black trees, since it requires, in order to |
| find a key, more math operations than they do. |
| Conversely, an ordered-vector tree requires far |
| lower space than the others. ([<a href="references.html#austern00noset">austern00noset</a>], |
| however, seems to have an implementation that is |
| also faster than a red-black tree).</p> |
| <p>A PATRICIA trie (<a href="trie.html"><tt>trie</tt></a> |
| with <tt>Tag =</tt> <a href="pat_trie_tag.html"><tt>pat_trie_tag</tt></a>) |
| has good look-up performance, due to its large |
| fan-out in this case. In this setting, a PATRICIA |
| trie has lookup performance comparable to a hash |
| table (see <a href="hash_text_find_find_timing_test.html">Hash-Based |
| Text <tt>find</tt> Find Timing Test</a>), but it is |
| order preserving. This is not that surprising, |
| since a large fan-out PATRICIA trie works like a |
| hash table with collisions resolved by a sub-trie. |
| A large fan-out PATRICIA trie does not do well on |
| modifications (see <a href="tree_text_insert_timing_test.html">Tree-Based and |
| Trie-Based Text Insert Timing Test</a>). It is |
| possibly beneficial to semi-static settings, |
| therefore.</p> |
| <p><a href="assoc_performance_tests.html#tree_like_based_types"> |
| Observations::Tree-Like-Based Container Types</a> |
| summarizes some observations on tree-based and |
| trie-based containers.</p> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </body> |
| </html> |