PageRenderTime 28ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/libstdc++-v3/doc/html/ext/pb_ds/priority_queue_random_int_push_pop_timing_test.html

https://bitbucket.org/pizzafactory/pf-gcc
HTML | 161 lines | 160 code | 1 blank | 0 comment | 0 complexity | 711643ebbe7afeb2854c037a43a9991e MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta name="generator" content="HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" />
  6. <title>Priority Queue Random Int Push Pop Timing Test</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
  8. </head>
  9. <body>
  10. <div id="page">
  11. <h1>Priority Queue Random Integer <tt>push</tt> and
  12. <tt>pop</tt> Timing Test</h1>
  13. <h2><a name="description" id="description">Description</a></h2>
  14. <p>This test inserts a number of values with i.i.d. integer
  15. keys into a container using <tt>push</tt> , then removes them
  16. using <tt>pop</tt> . It measures the average time for
  17. <tt>push</tt> and <tt>pop</tt> as a function of the number of
  18. values.</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_random_int_push_pop_timing.cc">
  20. <tt>priority_queue_random_int_push_pop_timing_test</tt></a>
  21. thirty_years_among_the_dead_preproc.txt 200 200 2100)</p>
  22. <h2><a name="purpose" id="purpose">Purpose</a></h2>
  23. <p>The test checks the effect of different underlying
  24. data structures (see <a href="pq_design.html#pq_imp">Design::Priority
  25. Queues::Implementations</a>).</p>
  26. <h2><a name="results" id="results">Results</a></h2>
  27. <p>Figures <a href="#NPG">NPG</a>, <a href="#NPM">NPM</a>, and
  28. <a href="#NPL">NPL</a> shows the results for the native
  29. priority queues and <tt>pb_ds</tt> 's priority queues in
  30. <a href="pq_performance_tests.html#gcc"><u>g++</u></a>,
  31. <a href="pq_performance_tests.html#msvc"><u>msvc++</u></a>, and
  32. <a href="pq_performance_tests.html#local"><u>local</u></a>,
  33. respectively.</p>
  34. <div id="NPG_res_div">
  35. <div id="NPG_gcc">
  36. <div id="NPG_priority_queue_random_int_push_pop_timing_test">
  37. <div id="NPG_pq">
  38. <div id="NPG_Native_and__tt_pb_ds_455tt__priority_queue__tt_push_455tt___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_random_int_push_pop_timing_test_gcc.png" alt="no image" /></a></h6>NPG: Native and <tt>pb ds</tt> priority queue <tt>push</tt> <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>
  39. <ol>
  40. <li>
  41. thin_heap-
  42. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  43. with <tt>Tag</tt> = <a href="thin_heap_tag.html"><tt>thin_heap_tag</tt></a>
  44. </li>
  45. <li>
  46. rc_binomial_heap-
  47. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  48. with <tt>Tag</tt> = <a href="rc_binomial_heap_tag.html"><tt>rc_binomial_heap_tag</tt></a>
  49. </li>
  50. <li>
  51. binomial_heap-
  52. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  53. with <tt>Tag</tt> = <a href="binomial_heap_tag.html"><tt>binomial_heap_tag</tt></a>
  54. </li>
  55. <li>
  56. pairing_heap-
  57. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  58. with <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a>
  59. </li>
  60. <li>
  61. n_pq_deque-
  62. <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
  63. <li>
  64. n_pq_vector-
  65. <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
  66. <li>
  67. binary_heap-
  68. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  69. with <tt>Tag</tt> = <a href="binary_heap_tag.html"><tt>binary_heap_tag</tt></a>
  70. </li>
  71. </ol>
  72. </div><div style="width: 100%; height: 20px"></div></div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <div id="NPM_res_div">
  78. <div id="NPM_msvc">
  79. <div id="NPM_priority_queue_random_int_push_pop_timing_test">
  80. <div id="NPM_pq">
  81. <div id="NPM_Native_and__tt_pb_ds_455tt__priority_queue__tt_push_455tt___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_random_int_push_pop_timing_test_msvc.png" alt="no image" /></a></h6>NPM: Native and <tt>pb ds</tt> priority queue <tt>push</tt> <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>
  82. <ol>
  83. <li>
  84. thin_heap-
  85. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  86. with <tt>Tag</tt> = <a href="thin_heap_tag.html"><tt>thin_heap_tag</tt></a>
  87. </li>
  88. <li>
  89. rc_binomial_heap-
  90. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  91. with <tt>Tag</tt> = <a href="rc_binomial_heap_tag.html"><tt>rc_binomial_heap_tag</tt></a>
  92. </li>
  93. <li>
  94. binomial_heap-
  95. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  96. with <tt>Tag</tt> = <a href="binomial_heap_tag.html"><tt>binomial_heap_tag</tt></a>
  97. </li>
  98. <li>
  99. pairing_heap-
  100. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  101. with <tt>Tag</tt> = <a href="pairing_heap_tag.html"><tt>pairing_heap_tag</tt></a>
  102. </li>
  103. <li>
  104. n_pq_deque-
  105. <tt>std::priority_queue</tt> adapting <tt>std::deque</tt></li>
  106. <li>
  107. n_pq_vector-
  108. <tt>std::priority_queue</tt> adapting <tt>std::vector</tt></li>
  109. <li>
  110. binary_heap-
  111. <a href="priority_queue.html"><tt>priority_queue</tt></a>
  112. with <tt>Tag</tt> = <a href="binary_heap_tag.html"><tt>binary_heap_tag</tt></a>
  113. </li>
  114. </ol>
  115. </div><div style="width: 100%; height: 20px"></div></div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div id="NPL_res_div">
  121. <div id="NPL_local">
  122. <div id="NPL_priority_queue_random_int_push_pop_timing_test">
  123. <div id="NPL_pq">
  124. <div id="NPL_Native_and__tt_pb_ds_455tt__priority_queue__tt_push_455tt___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_random_int_push_pop_timing_test_local.png" alt="no image" /></a></h6>NPL: Native and <tt>pb ds</tt> priority queue <tt>push</tt> <tt>pop</tt> timing test - <a href = "pq_performance_tests.html#local">local</a></div><div style = "width: 100%; height: 20px"></div></div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <h2><a name="observations" id="observations">Observations</a></h2>
  130. <p>Binary heaps are the most suited for sequences of
  131. <tt>push</tt> and <tt>pop</tt> operations of primitive types
  132. (<i>e.g.</i> <tt><b>int</b></tt>s). This is explained in
  133. <a href="priority_queue_random_int_push_timing_test.html">Priority
  134. Queue Random Int <tt>push</tt> Timing Test</a> . (See <a href="priority_queue_text_push_pop_timing_test.html">Priority Queue
  135. Text <tt>push</tt> Timing Test</a> for the case of primitive
  136. types.)</p>
  137. <p>At first glance it seems that the STL's vector-based
  138. priority queue is approximately on par with <tt>pb_ds</tt>'s
  139. corresponding priority queue. There are two differences
  140. however:</p>
  141. <ol>
  142. <li>The STL's priority queue does not downsize the underlying
  143. vector (or deque) as the priority queue becomes smaller
  144. (see <a href="priority_queue_text_pop_mem_usage_test.html">Priority Queue
  145. Text <tt>pop</tt> Memory Use Test</a>). It is therefore
  146. gaining some speed at the expense of space.</li>
  147. <li>From <a href="priority_queue_random_int_push_pop_timing_test.html">Priority
  148. Queue Random Integer <tt>push</tt> and <tt>pop</tt> Timing
  149. Test</a>, it seems that the STL's priority queue is slower in
  150. terms of <tt>pus</tt> operations. Since the number of
  151. <tt>pop</tt> operations is at most that of <tt>push</tt>
  152. operations, the test here is the "best" for the STL's
  153. priority queue.</li>
  154. </ol>
  155. <p><a href="pq_performance_tests.html#pq_observations">Priority-Queue
  156. Performance Tests::Observations</a> discusses this further and
  157. summarizes.</p>
  158. </div>
  159. </body>
  160. </html>