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 Pop Memory Use Test
</title>
8 <meta http-equiv=
"Content-Type" content=
"text/html; charset=us-ascii" />
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=
"../../../../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>,
31 <div id=
"NPG_res_div">
33 <div id=
"NPG_priority_queue_text_pop_mem_usage_test">
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>
39 <tt>std::priority_queue
</tt> adapting
<tt>std::vector
</tt></li>
42 <tt>std::priority_queue
</tt> adapting
<tt>std::deque
</tt></li>
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>
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>
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>
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>
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>
69 </div><div style=
"width: 100%; height: 20px"></div></div>
74 <div id=
"NPM_res_div">
76 <div id=
"NPM_priority_queue_text_pop_mem_usage_test">
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>
82 <tt>std::priority_queue
</tt> adapting
<tt>std::vector
</tt></li>
85 <tt>std::priority_queue
</tt> adapting
<tt>std::deque
</tt></li>
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>
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>
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>
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>
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>
112 </div><div style=
"width: 100%; height: 20px"></div></div>
117 <div id=
"NPL_res_div">
119 <div id=
"NPL_priority_queue_text_pop_mem_usage_test">
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>
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