Merge -r 127928:132243 from trunk
[official-gcc.git] / libstdc++-v3 / doc / html / ext / pb_ds / priority_queue_text_push_pop_timing_test.html
blob02fe32183a43f52bd6445a20a9ce09ec12fdfa23
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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>Priority Queue Text Push Pop 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>Priority Queue Text <tt>push</tt> and <tt>pop</tt> Timing
13 Test</h1>
14 <h2><a name="description" id="description">Description</a></h2>
15 <p>This test inserts a number of values with keys from an
16 arbitrary text ([ <a href="references.html#wickland96thirty">wickland96thirty</a> ]) into
17 a container using <tt>push</tt> , then removes them using
18 <tt>pop</tt> . It measures the average time for <tt>push</tt>
19 as a function of the number of values.</p>
20 <p>(The test was executed with <a href="../../../../testsuite/performance/ext/pb_ds/priority_queue_text_push_pop_timing.cc"><tt>
21 priority_queue_text_push_pop_timing_test</tt></a>
22 thirty_years_among_the_dead_preproc.txt 200 200 2100)</p>
23 <h2><a name="purpose" id="purpose">Purpose</a></h2>
24 <p>The test checks the effect of different underlying
25 data structures (see <a href="pq_design.html#pq_imp">Design::Priority
26 Queues::Implementations</a>).</p>
27 <h2><a name="results" id="results">Results</a></h2>
28 <p>Figures <a href="#NPG">NPG</a>, <a href="#NPM">NPM</a>, and
29 <a href="#NPL">NPL</a> show the results for the native priority
30 queues and <tt>pb_ds</tt> 's priority queues in <a href="pq_performance_tests.html#gcc"><u>g++</u></a>, <a href="pq_performance_tests.html#msvc"><u>msvc++</u></a>, and
31 <a href="pq_performance_tests.html#local"><u>local</u></a>,
32 respectively; Figures <a href="#NBRG">NBRG</a>, <a href="#NBRM">NBRM</a>, and <a href="#NBRL">NBRL</a> show the results
33 for the native priority queues and <tt>pb_ds</tt>'s pairing
34 queues in <a href="pq_performance_tests.html#gcc"><u>g++</u></a>, <a href="pq_performance_tests.html#msvc"><u>msvc++</u></a>, and
35 <a href="pq_performance_tests.html#local"><u>local</u></a>,
36 respectively.</p>
37 <div id="NPG_res_div">
38 <div id="NPG_gcc">
39 <div id="NPG_priority_queue_text_push_pop_timing_test">
40 <div id="NPG_pq">
41 <div id="NPG_Native_tree_and__tt_pb_ds_455tt__priority_queue__tt_push_455tt__and__tt_pop_455tt__timing_test"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NPG" id="NPG"><img src="priority_queue_text_push_pop_timing_test_gcc.png" alt="no image" /></a></h6>NPG: Native tree and <tt>pb ds</tt> priority queue <tt>push</tt> and <tt>pop</tt> timing test - <a href="pq_performance_tests.html#gcc">g++</a><p>In the above figure, the names in the legends have the following meaning:</p>
42 <ol>
43 <li>
44 n_pq_vector-
45 <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
46 <li>
47 n_pq_deque-
48 <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
49 <li>
50 thin_heap-
51 <a href="priority_queue.html"><tt>priority_queue</tt></a>
52 with <tt>Tag</tt> = <a href="thin_heap_tag.html"><tt>thin_heap_tag</tt></a>
53 </li>
54 <li>
55 rc_binomial_heap-
56 <a href="priority_queue.html"><tt>priority_queue</tt></a>
57 with <tt>Tag</tt> = <a href="rc_binomial_heap_tag.html"><tt>rc_binomial_heap_tag</tt></a>
58 </li>
59 <li>
60 binomial_heap-
61 <a href="priority_queue.html"><tt>priority_queue</tt></a>
62 with <tt>Tag</tt> = <a href="binomial_heap_tag.html"><tt>binomial_heap_tag</tt></a>
63 </li>
64 <li>
65 binary_heap-
66 <a href="priority_queue.html"><tt>priority_queue</tt></a>
67 with <tt>Tag</tt> = <a href="binary_heap_tag.html"><tt>binary_heap_tag</tt></a>
68 </li>
69 <li>
70 pairing_heap-
71 <a href="priority_queue.html"><tt>priority_queue</tt></a>
72 with <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a>
73 </li>
74 </ol>
75 </div><div style="width: 100%; height: 20px"></div></div>
76 </div>
77 </div>
78 </div>
79 </div>
80 <div id="NPM_res_div">
81 <div id="NPM_msvc">
82 <div id="NPM_priority_queue_text_push_pop_timing_test">
83 <div id="NPM_pq">
84 <div id="NPM_Native_tree_and__tt_pb_ds_455tt__priority_queue__tt_push_455tt__and__tt_pop_455tt__timing_test"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NPM" id="NPM"><img src="priority_queue_text_push_pop_timing_test_msvc.png" alt="no image" /></a></h6>NPM: Native tree and <tt>pb ds</tt> priority queue <tt>push</tt> and <tt>pop</tt> timing test - <a href="pq_performance_tests.html#msvc">msvc++</a><p>In the above figure, the names in the legends have the following meaning:</p>
85 <ol>
86 <li>
87 n_pq_deque-
88 <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
89 <li>
90 n_pq_vector-
91 <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
92 <li>
93 thin_heap-
94 <a href="priority_queue.html"><tt>priority_queue</tt></a>
95 with <tt>Tag</tt> = <a href="thin_heap_tag.html"><tt>thin_heap_tag</tt></a>
96 </li>
97 <li>
98 rc_binomial_heap-
99 <a href="priority_queue.html"><tt>priority_queue</tt></a>
100 with <tt>Tag</tt> = <a href="rc_binomial_heap_tag.html"><tt>rc_binomial_heap_tag</tt></a>
101 </li>
102 <li>
103 binomial_heap-
104 <a href="priority_queue.html"><tt>priority_queue</tt></a>
105 with <tt>Tag</tt> = <a href="binomial_heap_tag.html"><tt>binomial_heap_tag</tt></a>
106 </li>
107 <li>
108 pairing_heap-
109 <a href="priority_queue.html"><tt>priority_queue</tt></a>
110 with <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a>
111 </li>
112 <li>
113 binary_heap-
114 <a href="priority_queue.html"><tt>priority_queue</tt></a>
115 with <tt>Tag</tt> = <a href="binary_heap_tag.html"><tt>binary_heap_tag</tt></a>
116 </li>
117 </ol>
118 </div><div style="width: 100%; height: 20px"></div></div>
119 </div>
120 </div>
121 </div>
122 </div>
123 <div id="NPL_res_div">
124 <div id="NPL_local">
125 <div id="NPL_priority_queue_text_push_pop_timing_test">
126 <div id="NPL_pq">
127 <div id="NPL_Native_tree_and__tt_pb_ds_455tt__priority_queue__tt_push_455tt__and__tt_pop_455tt__timing_test"><div style = "border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NPL" id= "NPL"><img src="priority_queue_text_push_pop_timing_test_local.png" alt="no image" /></a></h6>NPL: Native tree and <tt>pb ds</tt> priority queue <tt>push</tt> and <tt>pop</tt> timing test - <a href = "pq_performance_tests.html#local">local</a></div><div style = "width: 100%; height: 20px"></div></div>
128 </div>
129 </div>
130 </div>
131 </div>
132 <div id="NBRG_res_div">
133 <div id="NBRG_gcc">
134 <div id="NBRG_pairing_priority_queue_text_push_pop_timing_test">
135 <div id="NBRG_pq">
136 <div id="NBRG_Native_tree_and__tt_pb_ds_455tt__pairing_priority_queue__tt_push_455tt__and__tt_pop_455tt__timing_test"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NBRG" id="NBRG"><img src="pairing_priority_queue_text_push_pop_timing_test_gcc.png" alt="no image" /></a></h6>NBRG: Native tree and <tt>pb ds</tt> pairing priority queue <tt>push</tt> and <tt>pop</tt> timing test - <a href="pq_performance_tests.html#gcc">g++</a><p>In the above figure, the names in the legends have the following meaning:</p>
137 <ol>
138 <li>
139 n_pq_vector-
140 <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
141 <li>
142 n_pq_deque-
143 <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
144 <li>
145 pairing_heap-
146 <a href="priority_queue.html"><tt>priority_queue</tt></a>
147 with <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a>
148 </li>
149 </ol>
150 </div><div style="width: 100%; height: 20px"></div></div>
151 </div>
152 </div>
153 </div>
154 </div>
155 <div id="NBRM_res_div">
156 <div id="NBRM_msvc">
157 <div id="NBRM_pairing_priority_queue_text_push_pop_timing_test">
158 <div id="NBRM_pq">
159 <div id="NBRM_Native_tree_and__tt_pb_ds_455tt__pairing_priority_queue__tt_push_455tt__and__tt_pop_455tt__timing_test"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NBRM" id="NBRM"><img src="pairing_priority_queue_text_push_pop_timing_test_msvc.png" alt="no image" /></a></h6>NBRM: Native tree and <tt>pb ds</tt> pairing priority queue <tt>push</tt> and <tt>pop</tt> timing test - <a href="pq_performance_tests.html#msvc">msvc++</a><p>In the above figure, the names in the legends have the following meaning:</p>
160 <ol>
161 <li>
162 n_pq_deque-
163 <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
164 <li>
165 n_pq_vector-
166 <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
167 <li>
168 pairing_heap-
169 <a href="priority_queue.html"><tt>priority_queue</tt></a>
170 with <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a>
171 </li>
172 </ol>
173 </div><div style="width: 100%; height: 20px"></div></div>
174 </div>
175 </div>
176 </div>
177 </div>
178 <div id="NBRL_res_div">
179 <div id="NBRL_local">
180 <div id="NBRL_pairing_priority_queue_text_push_pop_timing_test">
181 <div id="NBRL_pq">
182 <div id="NBRL_Native_tree_and__tt_pb_ds_455tt__pairing_priority_queue__tt_push_455tt__and__tt_pop_455tt__timing_test"><div style = "border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NBRL" id= "NBRL"><img src="pairing_priority_queue_text_push_pop_timing_test_local.png" alt="no image" /></a></h6>NBRL: Native tree and <tt>pb ds</tt> pairing priority queue <tt>push</tt> and <tt>pop</tt> timing test - <a href = "pq_performance_tests.html#local">local</a></div><div style = "width: 100%; height: 20px"></div></div>
183 </div>
184 </div>
185 </div>
186 </div>
187 <h2><a name="observations" id="observations">Observations</a></h2>
188 <p>These results are very similar to <a href="priority_queue_text_push_timing_test.html">Priority Queue Text
189 <tt>push</tt> Timing Test</a>. As stated there, pairing heaps
190 (<a href="priority_queue.html"><tt>priority_queue</tt></a> with
191 <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a>)
192 are most suited for <tt>push</tt> and <tt>pop</tt> sequences of
193 non-primitive types such as strings. Observing these two tests,
194 one can note that a pairing heap outperforms the others in
195 terms of <tt>push</tt> operations, but equals binary heaps
196 (<a href="priority_queue.html"><tt>priority_queue</tt></a> with
197 <tt>Tag</tt> = <a href="binary_heap_tag.html"><tt>binary_heap_tag</tt></a>) if
198 the number of <tt>push</tt> and <tt>pop</tt> operations is
199 equal. As the number of <tt>pop</tt> operations is at most
200 equal to the number of <tt>push</tt> operations, pairing heaps
201 are better in this case. See <a href="priority_queue_random_int_push_pop_timing_test.html">Priority
202 Queue Random Integer <tt>push</tt> and <tt>pop</tt> Timing
203 Test</a> for a case which is different.</p>
204 <p><a href="pq_performance_tests.html#pq_observations">Priority-Queue
205 Performance Tests::Observations</a> discusses this further and
206 summarizes.</p>
207 </div>
208 </body>
209 </html>