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">
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" />
12 <h1>Priority Queue Text <tt>push</tt> and <tt>pop</tt> Timing
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>,
37 <div id="NPG_res_div">
39 <div id="NPG_priority_queue_text_push_pop_timing_test">
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>
45 <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
48 <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
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>
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>
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>
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>
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>
75 </div><div style="width: 100%; height: 20px"></div></div>
80 <div id="NPM_res_div">
82 <div id="NPM_priority_queue_text_push_pop_timing_test">
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>
88 <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
91 <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
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>
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>
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>
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>
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>
118 </div><div style="width: 100%; height: 20px"></div></div>
123 <div id="NPL_res_div">
125 <div id="NPL_priority_queue_text_push_pop_timing_test">
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>
132 <div id="NBRG_res_div">
134 <div id="NBRG_pairing_priority_queue_text_push_pop_timing_test">
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>
140 <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
143 <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
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>
150 </div><div style="width: 100%; height: 20px"></div></div>
155 <div id="NBRM_res_div">
157 <div id="NBRM_pairing_priority_queue_text_push_pop_timing_test">
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>
163 <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
166 <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
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>
173 </div><div style="width: 100%; height: 20px"></div></div>
178 <div id="NBRL_res_div">
179 <div id="NBRL_local">
180 <div id="NBRL_pairing_priority_queue_text_push_pop_timing_test">
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>
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