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

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

https://bitbucket.org/pizzafactory/pf-gcc
HTML | 247 lines | 246 code | 1 blank | 0 comment | 0 complexity | 35f620ad885bde3ec87ee6c3bb8ac7db 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>Hash Random Int Find 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>Hash-Based Random-Integer <tt>find</tt> Find Timing
  12. Test</h1>
  13. <h2><a name="description" id="description">Description</a></h2>
  14. <p>This test inserts a number of values with uniform i.i.d.
  15. integer keys into a container, then performs a series of finds
  16. using <tt>find</tt>. It measures the average time
  17. for<tt>find</tt> as a function of the number of values
  18. inserted.</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/random_int_find_timing.cc"><tt>random_int_find_timing_test</tt></a>
  20. 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. hash-tables (see <a href="hash_based_containers.html">Design::Associative
  24. Containers::Associative Containers::Hash-Based Containers</a>),
  25. range-hashing functions, and trigger policies (see <a href="hash_based_containers.html#hash_policies">Design::Associative
  26. Containers::Hash-Based Containers::Hash Policies</a> and
  27. <a href="hash_based_containers.html#resize_policies">Design::Associative
  28. Containers::Hash-Based Containers::Resize Policies</a>).</p>
  29. <h2><a name="results" id="results">Results</a></h2>
  30. <p>Figures <a href="#NCCG">NCCG</a>, <a href="#NCCM">NCCM</a>,
  31. and <a href="#NCCL">NCCL</a> show the results for the native
  32. and collision-chaining types in <a href="assoc_performance_tests.html#gcc"><u>g++</u></a>, <a href="assoc_performance_tests.html#msvc"><u>MSVC++</u></a>, and
  33. <a href="assoc_performance_tests.html#local"><u>local</u></a>,
  34. respectively; Figures <a href="#NGPG">NGPG</a>, <a href="#NGPM">NGPM</a>, and <a href="#NGPL">NGPL</a> show the results
  35. for the native and probing types in <a href="assoc_performance_tests.html#gcc"><u>g++</u></a>, <a href="assoc_performance_tests.html#msvc"><u>MSVC++</u></a>, and
  36. <a href="assoc_performance_tests.html#local"><u>local</u></a>
  37. respectively.</p>
  38. <div id="NCCG_res_div">
  39. <div id="NCCG_gcc">
  40. <div id="NCCG_cc_hash_random_int_find_timing_test">
  41. <div id="NCCG_assoc">
  42. <div id="NCCG_Native_and_collision-chaining_hash_random_int_find_timing_test_using__tt_find_455tt_"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NCCG" id="NCCG"><img src="cc_hash_random_int_find_timing_test_gcc.png" alt="no image" /></a></h6>NCCG: Native and collision-chaining hash random int find timing test using <tt>find</tt> - <a href="assoc_performance_tests.html#gcc">g++</a><p>In the above figure, the names in the legends have the following meaning:</p>
  43. <ol>
  44. <li>
  45. n_hash_map_ncah-
  46. <tt>std::tr1::unordered_map</tt> with <tt>cache_hash_code</tt> = <tt><b>false</b></tt></li>
  47. <li>
  48. cc_hash_mod_prime_nea_lc_1div8_1div1_nsth_map-
  49. <a href="cc_hash_table.html"><tt>cc_hash_table</tt></a>
  50. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mod_range_hashing.html"><tt>direct_mod_range_hashing</tt></a>
  51. , and <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  52. with <tt>Size_Policy</tt> = <a href="hash_prime_size_policy.html"><tt>hash_prime_size_policy</tt></a>
  53. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  54. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/1</i></li>
  55. <li>
  56. cc_hash_mod_prime_nea_lc_1div8_1div2_nsth_map-
  57. <a href="cc_hash_table.html"><tt>cc_hash_table</tt></a>
  58. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mod_range_hashing.html"><tt>direct_mod_range_hashing</tt></a>
  59. , and <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  60. with <tt>Size_Policy</tt> = <a href="hash_prime_size_policy.html"><tt>hash_prime_size_policy</tt></a>
  61. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  62. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/2</i></li>
  63. <li>
  64. cc_hash_mask_exp_nea_lc_1div8_1div1_nsth_map-
  65. <a href="cc_hash_table.html"><tt>cc_hash_table</tt></a>
  66. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mask_range_hashing.html"><tt>direct_mask_range_hashing</tt></a>
  67. , and <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  68. with <tt>Size_Policy</tt> = <a href="hash_exponential_size_policy.html"><tt>hash_exponential_size_policy</tt></a>
  69. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  70. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/1</i></li>
  71. <li>
  72. cc_hash_mask_exp_nea_lc_1div8_1div2_nsth_map-
  73. <a href="cc_hash_table.html"><tt>cc_hash_table</tt></a>
  74. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mask_range_hashing.html"><tt>direct_mask_range_hashing</tt></a>
  75. , and <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  76. with <tt>Size_Policy</tt> = <a href="hash_exponential_size_policy.html"><tt>hash_exponential_size_policy</tt></a>
  77. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  78. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/2</i></li>
  79. </ol>
  80. </div><div style="width: 100%; height: 20px"></div></div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <div id="NCCM_res_div">
  86. <div id="NCCM_msvc">
  87. <div id="NCCM_cc_hash_random_int_find_timing_test">
  88. <div id="NCCM_assoc">
  89. <div id="NCCM_Native_and_collision-chaining_hash_random_int_find_timing_test_using__tt_find_455tt_"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NCCM" id="NCCM"><img src="cc_hash_random_int_find_timing_test_msvc.png" alt="no image" /></a></h6>NCCM: Native and collision-chaining hash random int find timing test using <tt>find</tt> - <a href="assoc_performance_tests.html#msvc">msvc++</a><p>In the above figure, the names in the legends have the following meaning:</p>
  90. <ol>
  91. <li>
  92. cc_hash_mod_prime_nea_lc_1div8_1div1_nsth_map-
  93. <a href="cc_hash_table.html"><tt>cc_hash_table</tt></a>
  94. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mod_range_hashing.html"><tt>direct_mod_range_hashing</tt></a>
  95. , and <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  96. with <tt>Size_Policy</tt> = <a href="hash_prime_size_policy.html"><tt>hash_prime_size_policy</tt></a>
  97. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  98. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/1</i></li>
  99. <li>
  100. cc_hash_mod_prime_nea_lc_1div8_1div2_nsth_map-
  101. <a href="cc_hash_table.html"><tt>cc_hash_table</tt></a>
  102. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mod_range_hashing.html"><tt>direct_mod_range_hashing</tt></a>
  103. , and <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  104. with <tt>Size_Policy</tt> = <a href="hash_prime_size_policy.html"><tt>hash_prime_size_policy</tt></a>
  105. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  106. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/2</i></li>
  107. <li>
  108. n_hash_map_ncah-
  109. <tt>stdext::hash_map</tt></li>
  110. <li>
  111. cc_hash_mask_exp_nea_lc_1div8_1div1_nsth_map-
  112. <a href="cc_hash_table.html"><tt>cc_hash_table</tt></a>
  113. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mask_range_hashing.html"><tt>direct_mask_range_hashing</tt></a>
  114. , and <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  115. with <tt>Size_Policy</tt> = <a href="hash_exponential_size_policy.html"><tt>hash_exponential_size_policy</tt></a>
  116. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  117. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/1</i></li>
  118. <li>
  119. cc_hash_mask_exp_nea_lc_1div8_1div2_nsth_map-
  120. <a href="cc_hash_table.html"><tt>cc_hash_table</tt></a>
  121. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mask_range_hashing.html"><tt>direct_mask_range_hashing</tt></a>
  122. , and <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  123. with <tt>Size_Policy</tt> = <a href="hash_exponential_size_policy.html"><tt>hash_exponential_size_policy</tt></a>
  124. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  125. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/2</i></li>
  126. </ol>
  127. </div><div style="width: 100%; height: 20px"></div></div>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <div id="NCCL_res_div">
  133. <div id="NCCL_local">
  134. <div id="NCCL_cc_hash_random_int_find_timing_test">
  135. <div id="NCCL_assoc">
  136. <div id="NCCL_Native_and_collision-chaining_hash_random_int_find_timing_test_using__tt_find_455tt_"><div style = "border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NCCL" id= "NCCL"><img src="cc_hash_random_int_find_timing_test_local.png" alt="no image" /></a></h6>NCCL: Native and collision-chaining hash random int find timing test using <tt>find</tt> - <a href = "assoc_performance_tests.html#local">local</a></div><div style = "width: 100%; height: 20px"></div></div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <div id="NGPG_res_div">
  142. <div id="NGPG_gcc">
  143. <div id="NGPG_gp_hash_random_int_find_timing_test">
  144. <div id="NGPG_assoc">
  145. <div id="NGPG_Native_and_collision-chaining_hash_random_int_find_timing_test_using__tt_find_455tt_"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NGPG" id="NGPG"><img src="gp_hash_random_int_find_timing_test_gcc.png" alt="no image" /></a></h6>NGPG: Native and collision-chaining hash random int find timing test using <tt>find</tt> - <a href="assoc_performance_tests.html#gcc">g++</a><p>In the above figure, the names in the legends have the following meaning:</p>
  146. <ol>
  147. <li>
  148. gp_hash_mod_quadp_prime_nea_lc_1div8_1div2_nsth_map-
  149. <a href="gp_hash_table.html"><tt>gp_hash_table</tt></a>
  150. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mod_range_hashing.html"><tt>direct_mod_range_hashing</tt></a>
  151. , <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  152. with <tt>Size_Policy</tt> = <a href="hash_prime_size_policy.html"><tt>hash_prime_size_policy</tt></a>
  153. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  154. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/2</i>, and <tt>Probe_Fn</tt> = <a href="quadratic_probe_fn.html"><tt>quadratic_probe_fn</tt></a>
  155. </li>
  156. <li>
  157. n_hash_map_ncah-
  158. <tt>std::tr1::unordered_map</tt> with <tt>cache_hash_code</tt> = <tt><b>false</b></tt></li>
  159. <li>
  160. gp_hash_mask_linp_exp_nea_lc_1div8_1div2_nsth_map-
  161. <a href="gp_hash_table.html"><tt>gp_hash_table</tt></a>
  162. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mask_range_hashing.html"><tt>direct_mask_range_hashing</tt></a>
  163. , <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  164. with <tt>Size_Policy</tt> = <a href="hash_exponential_size_policy.html"><tt>hash_exponential_size_policy</tt></a>
  165. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  166. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/2</i>, and <tt>Probe_Fn</tt> = <a href="linear_probe_fn.html"><tt>linear_probe_fn</tt></a>
  167. </li>
  168. </ol>
  169. </div><div style="width: 100%; height: 20px"></div></div>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <div id="NGPM_res_div">
  175. <div id="NGPM_msvc">
  176. <div id="NGPM_gp_hash_random_int_find_timing_test">
  177. <div id="NGPM_assoc">
  178. <div id="NGPM_Native_and_collision-chaining_hash_random_int_find_timing_test_using__tt_find_455tt_"><div style="border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NGPM" id="NGPM"><img src="gp_hash_random_int_find_timing_test_msvc.png" alt="no image" /></a></h6>NGPM: Native and collision-chaining hash random int find timing test using <tt>find</tt> - <a href="assoc_performance_tests.html#msvc">msvc++</a><p>In the above figure, the names in the legends have the following meaning:</p>
  179. <ol>
  180. <li>
  181. gp_hash_mod_quadp_prime_nea_lc_1div8_1div2_nsth_map-
  182. <a href="gp_hash_table.html"><tt>gp_hash_table</tt></a>
  183. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mod_range_hashing.html"><tt>direct_mod_range_hashing</tt></a>
  184. , <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  185. with <tt>Size_Policy</tt> = <a href="hash_prime_size_policy.html"><tt>hash_prime_size_policy</tt></a>
  186. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  187. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/2</i>, and <tt>Probe_Fn</tt> = <a href="quadratic_probe_fn.html"><tt>quadratic_probe_fn</tt></a>
  188. </li>
  189. <li>
  190. n_hash_map_ncah-
  191. <tt>stdext::hash_map</tt></li>
  192. <li>
  193. gp_hash_mask_linp_exp_nea_lc_1div8_1div2_nsth_map-
  194. <a href="gp_hash_table.html"><tt>gp_hash_table</tt></a>
  195. with <tt>Comb_Hash_Fn</tt> = <a href="direct_mask_range_hashing.html"><tt>direct_mask_range_hashing</tt></a>
  196. , <tt>Resize_Policy</tt> = <a href="hash_standard_resize_policy.html"><tt>hash_standard_resize_policy</tt></a>
  197. with <tt>Size_Policy</tt> = <a href="hash_exponential_size_policy.html"><tt>hash_exponential_size_policy</tt></a>
  198. , and <tt>Trigger_Policy</tt> = <a href="hash_load_check_resize_trigger.html"><tt>hash_load_check_resize_trigger</tt></a>
  199. with <i>&alpha;<sub>min</sub></i> = <i>1/8</i> and <i>&alpha;<sub>max</sub></i> = <i>1/2</i>, and <tt>Probe_Fn</tt> = <a href="linear_probe_fn.html"><tt>linear_probe_fn</tt></a>
  200. </li>
  201. </ol>
  202. </div><div style="width: 100%; height: 20px"></div></div>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. <div id="NGPL_res_div">
  208. <div id="NGPL_local">
  209. <div id="NGPL_gp_hash_random_int_find_timing_test">
  210. <div id="NGPL_assoc">
  211. <div id="NGPL_Native_and_collision-chaining_hash_random_int_find_timing_test_using__tt_find_455tt_"><div style = "border-style: dotted; border-width: 1px; border-color: lightgray"><h6 class="c1"><a name="NGPL" id= "NGPL"><img src="gp_hash_random_int_find_timing_test_local.png" alt="no image" /></a></h6>NGPL: Native and collision-chaining hash random int find timing test using <tt>find</tt> - <a href = "assoc_performance_tests.html#local">local</a></div><div style = "width: 100%; height: 20px"></div></div>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. <h2><a name="observations" id="observations">Observations</a></h2>
  217. <p>In this setting, the choice of underlying hash-table (see
  218. <a href="hash_based_containers.html">Design::Associative
  219. Containers::Hash-Based Containers</a> ) affects performance
  220. most, then the range-hashing scheme (See <a href="hash_based_containers.html#hash_policies">Design::Associative
  221. Containers::Hash-Based Containers::Hash Policies</a> ), and,
  222. only finally, other policies.</p>
  223. <p>When comparing Figures <a href="#NCCG">NCCG</a> and <a href="#NCCM">NCCM</a> to <a href="#NGPG">NGPG</a> and <a href="#NGPM">NGPM</a> , respectively, it is apparent that the
  224. probing containers are less efficient than the
  225. collision-chaining containers (both
  226. <tt>std::tr1::unordered_map</tt> and <tt>stdext::hash_map</tt>
  227. use collision-chaining) in this case.</p>
  228. <p>( <a href="hash_random_int_subscript_insert_timing_test.html">Hash-Based
  229. Random-Integer Subscript Insert Timing Test</a> shows a
  230. different case, where the situation is reversed; <a href="assoc_performance_tests.html#hash_based_types">Observations::Hash-Based
  231. Container Types</a> discusses some further considerations.)</p>
  232. <p>Within each type of hash-table, the range-hashing scheme
  233. affects performance more than other policies; <a href="hash_text_find_find_timing_test.html#observations">Hash-Based
  234. Text <tt>find</tt> Find Timing Test::Observations</a> discusses
  235. this. In Figures <a href="#NCCG">NCCG</a> , <a href="#NCCM">NCCM</a> , <a href="#NGPG">NGPG</a> , and <a href="#NGPM">NGPM</a> , it should be noted that
  236. <tt>std::tr1::unordered_map</tt> and <tt>stdext::hash_map</tt>
  237. are hard-wired currently to mod-based and mask-based schemes,
  238. respectively.</p>
  239. <p><a href="assoc_performance_tests.html#hash_based_types">Observations::Hash-Based
  240. Container Types</a> summarizes some observations on hash-based
  241. containers; <a href="assoc_performance_tests.html#hash_based_policies">Observations::Hash-Based
  242. Containers' Policies</a> summarizes some observations on
  243. hash-based containers' policies.</p>
  244. </div>
  245. </body>
  246. </html>