]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libstdc++-v3/contrib/libstdc++-v3-4.3.3/doc/html/ext/pb_ds/tree_order_statistics_timing_test.html
update
[l4.git] / l4 / pkg / libstdc++-v3 / contrib / libstdc++-v3-4.3.3 / doc / html / ext / pb_ds / tree_order_statistics_timing_test.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <head>
6 <meta name="generator" content="HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" />
7 <title>Tree Order Statistics Timing Test</title>
8 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
9 </head>
10 <body>
11 <div id="page">
12 <h1>Tree Order-Statistics Timing Test</h1>
13 <h2><a name="description" id="description">Description</a></h2>
14 <p>This test creates a container, inserts random integers into
15     the the container, and then checks the order-statistics of the
16     container's values. (If the container is one of <tt>pb_ds</tt>
17     's trees, it does this with the <tt>order_of_key</tt> method of
18     <a href="tree_order_statistics_node_update.html"><tt>tree_order_statistics_node_update</tt></a>
19     ; otherwise, it uses the <tt>find</tt> method and
20     <tt>std::distance</tt> .) It measures the average time for such
21     queries as a function of the number of values inserted.</p>
22 <p>(The test was executed with <a href="../../../../testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc"><tt>tree_order_statistics_timing_test</tt></a>
23     200 200 2100)</p>
24 <h2><a name="purpose" id="purpose">Purpose</a></h2>
25 <p>The test checks the performance difference of policies based
26     on node-invariant as opposed to a external functions. (see
27     <a href="tree_based_containers.html#invariants">Design::Associative
28     Containers::Tree-Based Containers::Node Invariants</a> .)</p>
29 <h2><a name="results" id="results">Results</a></h2>
30 <p>Figures <a href="#NTG">NTG</a>, <a href="#NTM">NTM</a>, and
31     <a href="#NTL">NTL</a> show the results for the native and
32     tree-based containers in <a href="assoc_performance_tests.html#gcc"><u>g++</u></a>, <a href="assoc_performance_tests.html#msvc"><u>msvc++</u></a>, and
33     <a href="assoc_performance_tests.html#local"><u>local</u></a>,
34     respectively.</p>
35 <div id="NTG_res_div">
36 <div id="NTG_gcc">
37 <div id="NTG_tree_order_statistics_timing_test">
38 <div id="NTG_assoc">
39 <div id="NTG_Native_and_tree-based_container_order-statistics_queries"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NTG" id="NTG"><img src="tree_order_statistics_timing_test_gcc.png" alt="no image" /></a></h6>NTG: Native and tree-based container order-statistics queries - <a href="assoc_performance_tests.html#gcc">g++</a><p>In the above figure, the names in the legends have the following meaning:</p>
40 <ol>
41 <li>
42 n_set-
43 <tt>std::set</tt></li>
44 <li>
45 splay_tree_ost_set-
46 <a href="tree.html"><tt>tree</tt></a>
47  with <tt>Tag</tt> = <a href="splay_tree_tag.html"><tt>splay_tree_tag</tt></a>
48 , and <tt>Node_Update</tt> = <a href="tree_order_statistics_node_update.html"><tt>tree_order_statistics_node_update</tt></a>
49 </li>
50 <li>
51 rb_tree_ost_set-
52 <a href="tree.html"><tt>tree</tt></a>
53  with <tt>Tag</tt> = <a href="rb_tree_tag.html"><tt>rb_tree_tag</tt></a>
54 , and <tt>Node_Update</tt> = <a href="tree_order_statistics_node_update.html"><tt>tree_order_statistics_node_update</tt></a>
55 </li>
56 </ol>
57 </div><div style="width: 100%; height: 20px"></div></div>
58 </div>
59 </div>
60 </div>
61 </div>
62 <div id="NTM_res_div">
63 <div id="NTM_msvc">
64 <div id="NTM_tree_order_statistics_timing_test">
65 <div id="NTM_assoc">
66 <div id="NTM_Native_and_tree-based_container_order-statistics_queries"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NTM" id="NTM"><img src="tree_order_statistics_timing_test_msvc.png" alt="no image" /></a></h6>NTM: Native and tree-based container order-statistics queries - <a href="assoc_performance_tests.html#msvc">msvc++</a><p>In the above figure, the names in the legends have the following meaning:</p>
67 <ol>
68 <li>
69 n_set-
70 <tt>std::set</tt></li>
71 <li>
72 splay_tree_ost_set-
73 <a href="tree.html"><tt>tree</tt></a>
74  with <tt>Tag</tt> = <a href="splay_tree_tag.html"><tt>splay_tree_tag</tt></a>
75 , and <tt>Node_Update</tt> = <a href="tree_order_statistics_node_update.html"><tt>tree_order_statistics_node_update</tt></a>
76 </li>
77 <li>
78 rb_tree_ost_set-
79 <a href="tree.html"><tt>tree</tt></a>
80  with <tt>Tag</tt> = <a href="rb_tree_tag.html"><tt>rb_tree_tag</tt></a>
81 , and <tt>Node_Update</tt> = <a href="tree_order_statistics_node_update.html"><tt>tree_order_statistics_node_update</tt></a>
82 </li>
83 </ol>
84 </div><div style="width: 100%; height: 20px"></div></div>
85 </div>
86 </div>
87 </div>
88 </div>
89 <div id="NTL_res_div">
90 <div id="NTL_local">
91 <div id="NTL_tree_order_statistics_timing_test">
92 <div id="NTL_assoc">
93 <div id="NTL_Native_and_tree-based_container_order-statistics_queries"><div style = "border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NTL" id= "NTL"><img src="tree_order_statistics_timing_test_local.png" alt="no image" /></a></h6>NTL: Native and tree-based container order-statistics queries - <a href = "assoc_performance_tests.html#local">local</a></div><div style = "width: 100%; height: 20px"></div></div>
94 </div>
95 </div>
96 </div>
97 </div>
98 <h2><a name="observations" id="observations">Observations</a></h2>
99 <p>In this test, the native red-black tree can support
100     order-statistics queries only externally, by performing a
101     <tt>find</tt> (alternatively, <tt>lower_bound</tt> or
102     <tt>upper_bound</tt> ) and then using <tt>std::distance</tt> .
103     This is clearly linear, and it is not that surprising that the
104     cost is high.</p>
105 <p><tt>pb_ds</tt> 's tree-based containers use in this test the
106     <tt>order_of_key</tt> method of <a href="tree_order_statistics_node_update.html"><tt>tree_order_statistics_node_update</tt></a>.
107     This method has only linear complexity in the length of the
108     root-node path. Unfortunately, the average path of a splay tree
109     (<a href="tree.html"><tt>tree</tt></a>
110     with <tt>Tag =</tt> <a href="splay_tree_tag.html"><tt>splay_tree_tag</tt></a> ) can
111     be higher than logarithmic; the longest path of a red-black
112     tree (<a href="tree.html"><tt>tree</tt></a>
113     with <tt>Tag =</tt> <a href="rb_tree_tag.html"><tt>rb_tree_tag</tt></a> ) is
114     logarithmic in the number of elements. Consequently, the splay
115     tree has worse performance than the red-black tree.</p>
116 </div>
117 </body>
118 </html>