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>Priority Queue Text Pop Memory Use 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>pop</tt> Memory Use Test</h1> 13<h2><a name="description" id="description">Description</a></h2> 14<p>This test inserts a number of values with keys from an 15 arbitrary text ([ <a href="references.html#wickland96thirty">wickland96thirty</a> ]) into 16 a container, then pops them until only one is left in the 17 container. It measures the memory use as a function of the 18 number of values pushed to the container.</p> 19<p>(The test was executed with <a href="http://gcc.gnu.org/viewcvs/*checkout*/trunk/libstdc%2B%2B-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc"><tt>priority_queue_text_pop_mem_usage_test</tt></a> 20 thirty_years_among_the_dead_preproc.txt 200 200 2100)</p> 21<h2><a name="purpose" id="purpose">Purpose</a></h2> 22<p>The test checks the effect of different underlying 23 data structures (see <a href="pq_design.html#pq_imp">Design::Priority 24 Queues::Implementations</a>).</p> 25<h2><a name="results" id="results">Results</a></h2> 26<p>Figures <a href="#NPG">NPG</a>, <a href="#NPM">NPM</a>, and 27 <a href="#NPL">NPL</a> show the results for the native priority 28 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 29 <a href="pq_performance_tests.html#local"><u>local</u></a>, 30 respectively.</p> 31<div id="NPG_res_div"> 32<div id="NPG_gcc"> 33<div id="NPG_priority_queue_text_pop_mem_usage_test"> 34<div id="NPG_pq"> 35<div id="NPG_Native_and__tt_pb_ds_455tt__priority_queue__tt_pop_455tt__memory-use_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_pop_mem_usage_test_gcc.png" alt="no image" /></a></h6>NPG: Native and <tt>pb ds</tt> priority queue <tt>pop</tt> memory-use 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> 36<ol> 37<li> 38n_pq_vector- 39<tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li> 40<li> 41n_pq_deque- 42<tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li> 43<li> 44binary_heap- 45<a href="priority_queue.html"><tt>priority_queue</tt></a> 46 with <tt>Tag</tt> = <a href="binary_heap_tag.html"><tt>binary_heap_tag</tt></a> 47</li> 48<li> 49thin_heap- 50<a href="priority_queue.html"><tt>priority_queue</tt></a> 51 with <tt>Tag</tt> = <a href="thin_heap_tag.html"><tt>thin_heap_tag</tt></a> 52</li> 53<li> 54binomial_heap- 55<a href="priority_queue.html"><tt>priority_queue</tt></a> 56 with <tt>Tag</tt> = <a href="binomial_heap_tag.html"><tt>binomial_heap_tag</tt></a> 57</li> 58<li> 59rc_binomial_heap- 60<a href="priority_queue.html"><tt>priority_queue</tt></a> 61 with <tt>Tag</tt> = <a href="rc_binomial_heap_tag.html"><tt>rc_binomial_heap_tag</tt></a> 62</li> 63<li> 64pairing_heap- 65<a href="priority_queue.html"><tt>priority_queue</tt></a> 66 with <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a> 67</li> 68</ol> 69</div><div style="width: 100%; height: 20px"></div></div> 70</div> 71</div> 72</div> 73</div> 74<div id="NPM_res_div"> 75<div id="NPM_msvc"> 76<div id="NPM_priority_queue_text_pop_mem_usage_test"> 77<div id="NPM_pq"> 78<div id="NPM_Native_and__tt_pb_ds_455tt__priority_queue__tt_pop_455tt__memory-use_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_pop_mem_usage_test_msvc.png" alt="no image" /></a></h6>NPM: Native and <tt>pb ds</tt> priority queue <tt>pop</tt> memory-use 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> 79<ol> 80<li> 81n_pq_vector- 82<tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li> 83<li> 84n_pq_deque- 85<tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li> 86<li> 87binary_heap- 88<a href="priority_queue.html"><tt>priority_queue</tt></a> 89 with <tt>Tag</tt> = <a href="binary_heap_tag.html"><tt>binary_heap_tag</tt></a> 90</li> 91<li> 92thin_heap- 93<a href="priority_queue.html"><tt>priority_queue</tt></a> 94 with <tt>Tag</tt> = <a href="thin_heap_tag.html"><tt>thin_heap_tag</tt></a> 95</li> 96<li> 97binomial_heap- 98<a href="priority_queue.html"><tt>priority_queue</tt></a> 99 with <tt>Tag</tt> = <a href="binomial_heap_tag.html"><tt>binomial_heap_tag</tt></a> 100</li> 101<li> 102rc_binomial_heap- 103<a href="priority_queue.html"><tt>priority_queue</tt></a> 104 with <tt>Tag</tt> = <a href="rc_binomial_heap_tag.html"><tt>rc_binomial_heap_tag</tt></a> 105</li> 106<li> 107pairing_heap- 108<a href="priority_queue.html"><tt>priority_queue</tt></a> 109 with <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a> 110</li> 111</ol> 112</div><div style="width: 100%; height: 20px"></div></div> 113</div> 114</div> 115</div> 116</div> 117<div id="NPL_res_div"> 118<div id="NPL_local"> 119<div id="NPL_priority_queue_text_pop_mem_usage_test"> 120<div id="NPL_pq"> 121<div id="NPL_Native_and__tt_pb_ds_455tt__priority_queue__tt_pop_455tt__memory-use_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_pop_mem_usage_test_local.png" alt="no image" /></a></h6>NPL: Native and <tt>pb ds</tt> priority queue <tt>pop</tt> memory-use test - <a href = "pq_performance_tests.html#local">local</a></div><div style = "width: 100%; height: 20px"></div></div> 122</div> 123</div> 124</div> 125</div> 126<h2><a name="observations" id="observations">Observations</a></h2> 127<p>The priority queue implementations (excluding the STL's) use 128 memory proportionally to the number of values they hold: 129 node-based implementations (<i>e.g.</i>, a pairing heap) do so 130 naturally; <tt>pb_ds</tt>'s binary heap de-allocates memory when 131 a certain lower threshold is exceeded.</p> 132<p>Note from <a href="priority_queue_text_push_pop_timing_test.html">Priority Queue 133 Text <tt>push</tt> and <tt>pop</tt> Timing Test</a> and 134 <a href="priority_queue_random_int_push_pop_timing_test.html">Priority 135 Queue Random Integer <tt>push</tt> and <tt>pop</tt> Timing 136 Test</a> that this does not impede performance compared to the 137 STL's priority queues.</p> 138<p>(See <a href="hash_random_int_erase_mem_usage_test.html">Hash-Based Erase 139 Memory Use Test</a> for a similar phenomenon regarding priority 140 queues.)</p> 141</div> 142</body> 143</html> 144