diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index 1d2e9d80..108c18e9 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -2,1260 +2,1260 @@ benches: btreemap_v2_contains_10mib_values: total: calls: 1 - instructions: 18483721 + instructions: 16632877 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_256_128: total: calls: 1 - instructions: 898074463 + instructions: 899462217 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_0: total: calls: 1 - instructions: 286876333 + instructions: 285296168 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_1024: total: calls: 1 - instructions: 280845034 + instructions: 277932878 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_128: total: calls: 1 - instructions: 240212893 + instructions: 240233990 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_8_128: total: calls: 1 - instructions: 189757294 + instructions: 190764575 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_principal: total: calls: 1 - instructions: 248326038 + instructions: 249247060 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_then_remove_blob_32_128: total: calls: 1 - instructions: 929822486 + instructions: 735347850 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_then_remove_u64_u64: total: calls: 1 - instructions: 736289775 + instructions: 597959237 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_then_remove_u64_u64_nocache: total: calls: 1 - instructions: 783052278 + instructions: 788784522 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_u64_u64: total: calls: 1 - instructions: 169813378 + instructions: 170994633 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_128: total: calls: 1 - instructions: 293090409 + instructions: 293574736 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_vec128: total: calls: 1 - instructions: 293090409 + instructions: 293574736 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_zipf_10k_u64_u64: total: calls: 1 - instructions: 135393801 + instructions: 135743772 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_blob_256_128: total: calls: 1 - instructions: 352584649 + instructions: 458120431 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_blob_32_0: total: calls: 1 - instructions: 100509231 + instructions: 99688275 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_blob_32_1024: total: calls: 1 - instructions: 255015339 + instructions: 259497164 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_blob_32_128: total: calls: 1 - instructions: 106205810 + instructions: 104795876 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_blob_8_128: total: calls: 1 - instructions: 55702017 + instructions: 55624843 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_principal: total: calls: 1 - instructions: 31523019 + instructions: 31505971 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_u64_u64: total: calls: 1 - instructions: 84894284 + instructions: 90215726 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_vec_32_128: total: calls: 1 - instructions: 38655866 + instructions: 38587267 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_first_key_value_vec_32_vec128: total: calls: 1 - instructions: 38655866 + instructions: 38587267 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_100k_u64_u64: total: calls: 1 - instructions: 2324488694 + instructions: 2343388637 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_100k_u64_u64_nocache: total: calls: 1 - instructions: 2825742493 + instructions: 2825742406 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_10mib_values: total: calls: 1 - instructions: 264853978 + instructions: 263003134 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob8_u64: total: calls: 1 - instructions: 205954574 + instructions: 205616407 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_1024_128: total: calls: 1 - instructions: 2973112544 + instructions: 2976233508 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_128_128: total: calls: 1 - instructions: 575786182 + instructions: 575922479 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_16_128: total: calls: 1 - instructions: 222873051 + instructions: 221769167 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_256_128: total: calls: 1 - instructions: 903185650 + instructions: 904561550 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_0: total: calls: 1 - instructions: 288586363 + instructions: 287006110 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_1024: total: calls: 1 - instructions: 292713740 + instructions: 290666868 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_128: total: calls: 1 - instructions: 244952082 + instructions: 245316350 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_16: total: calls: 1 - instructions: 249242168 + instructions: 247635259 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_256: total: calls: 1 - instructions: 249314946 + instructions: 248110723 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_32: total: calls: 1 - instructions: 247473705 + instructions: 244416294 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_4: total: calls: 1 - instructions: 248138409 + instructions: 246846060 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_512: total: calls: 1 - instructions: 257516792 + instructions: 257682297 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_64: total: calls: 1 - instructions: 248375748 + instructions: 247516635 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_8: total: calls: 1 - instructions: 245327388 + instructions: 247087511 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_4_128: total: calls: 1 - instructions: 168233768 + instructions: 169181540 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_512_128: total: calls: 1 - instructions: 1589182180 + instructions: 1591956275 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_64_128: total: calls: 1 - instructions: 336202166 + instructions: 336177062 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_8_128: total: calls: 1 - instructions: 194846097 + instructions: 195978915 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_miss_u64_u64: total: calls: 1 - instructions: 177058170 + instructions: 178307024 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_miss_u64_u64_nocache: total: calls: 1 - instructions: 235378595 + instructions: 235378508 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_miss_zipf_10k_u64_u64: total: calls: 1 - instructions: 170849126 + instructions: 171909834 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_principal: total: calls: 1 - instructions: 250186765 + instructions: 251107699 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_insert_blob_32_128: total: calls: 1 - instructions: 772136939 + instructions: 525765859 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_insert_u64_u64: total: calls: 1 - instructions: 542500156 + instructions: 375030642 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_insert_u64_u64_nocache: total: calls: 1 - instructions: 594578003 + instructions: 604576977 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_remove_blob_32_128: total: calls: 1 - instructions: 962059972 + instructions: 750750883 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_remove_u64_u64: total: calls: 1 - instructions: 740840122 + instructions: 602628511 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_remove_u64_u64_nocache: total: calls: 1 - instructions: 787584834 + instructions: 793317078 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_u64_blob8: total: calls: 1 - instructions: 193975365 + instructions: 194648488 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_u64_u64: total: calls: 1 - instructions: 174490279 + instructions: 175700899 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_u64_vec8: total: calls: 1 - instructions: 167443479 + instructions: 168427952 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec8_u64: total: calls: 1 - instructions: 270920846 + instructions: 265721428 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_1024_128: total: calls: 1 - instructions: 1401866850 + instructions: 1400848737 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_128_128: total: calls: 1 - instructions: 479287247 + instructions: 480257637 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_16_128: total: calls: 1 - instructions: 344463484 + instructions: 344724815 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_256_128: total: calls: 1 - instructions: 646324172 + instructions: 644328825 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_0: total: calls: 1 - instructions: 273323059 + instructions: 273037776 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_1024: total: calls: 1 - instructions: 445969681 + instructions: 445716443 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_128: total: calls: 1 - instructions: 299430441 + instructions: 300131961 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_16: total: calls: 1 - instructions: 308866094 + instructions: 308851199 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_256: total: calls: 1 - instructions: 327674384 + instructions: 327999269 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_32: total: calls: 1 - instructions: 268350949 + instructions: 269052857 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_4: total: calls: 1 - instructions: 270096896 + instructions: 269993263 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_512: total: calls: 1 - instructions: 345969254 + instructions: 347952793 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_64: total: calls: 1 - instructions: 289651598 + instructions: 287241239 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_8: total: calls: 1 - instructions: 266782433 + instructions: 266996994 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_4_128: total: calls: 1 - instructions: 208489486 + instructions: 211972536 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_512_128: total: calls: 1 - instructions: 1031162081 + instructions: 1030433439 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_64_128: total: calls: 1 - instructions: 402810590 + instructions: 401774425 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_8_128: total: calls: 1 - instructions: 281643619 + instructions: 282634913 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_zipf_100k_u64_u64: total: calls: 1 - instructions: 1985797141 + instructions: 1991798722 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_zipf_100k_u64_u64_nocache: total: calls: 1 - instructions: 2743225280 + instructions: 2743225193 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_zipf_10k_u64_u64: total: calls: 1 - instructions: 140000904 + instructions: 140464655 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_zipf_10k_u64_u64_nocache: total: calls: 1 - instructions: 226994813 + instructions: 226994711 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_zipf_heavy_10k_u64_u64: total: calls: 1 - instructions: 87479763 + instructions: 87684088 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_100k_u64_u64: total: calls: 1 - instructions: 4783069961 + instructions: 4291778109 heap_increase: 0 stable_memory_increase: 60 scopes: {} btreemap_v2_insert_10mib_values: total: calls: 1 - instructions: 4389920873 + instructions: 4375302957 heap_increase: 161 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 438891007 + instructions: 342831527 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: calls: 1 - instructions: 5498621739 - heap_increase: 0 + instructions: 4089419201 + heap_increase: 2 stable_memory_increase: 196 scopes: {} btreemap_v2_insert_blob_128_128: total: calls: 1 - instructions: 1183240670 + instructions: 898938251 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: calls: 1 - instructions: 488586148 + instructions: 397233634 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: calls: 1 - instructions: 1791440822 + instructions: 1385784168 heap_increase: 0 stable_memory_increase: 67 scopes: {} btreemap_v2_insert_blob_32_0: total: calls: 1 - instructions: 492829237 + instructions: 404010801 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_1024: total: calls: 1 - instructions: 705873529 + instructions: 640535326 heap_increase: 0 stable_memory_increase: 173 scopes: {} btreemap_v2_insert_blob_32_128: total: calls: 1 - instructions: 544934108 + instructions: 448746352 heap_increase: 0 stable_memory_increase: 28 scopes: {} btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 521502709 + instructions: 438405771 heap_increase: 0 stable_memory_increase: 11 scopes: {} btreemap_v2_insert_blob_32_256: total: calls: 1 - instructions: 573067512 + instructions: 479120078 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: calls: 1 - instructions: 531331458 + instructions: 433815169 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 511755349 + instructions: 420418817 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: calls: 1 - instructions: 612438263 + instructions: 543376008 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: calls: 1 - instructions: 537296782 + instructions: 447280905 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: calls: 1 - instructions: 519958093 + instructions: 423948483 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: calls: 1 - instructions: 409378756 + instructions: 325528558 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_512_128: total: calls: 1 - instructions: 3043628657 - heap_increase: 0 + instructions: 2240845938 + heap_increase: 1 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: calls: 1 - instructions: 663570679 + instructions: 565741268 heap_increase: 0 stable_memory_increase: 34 scopes: {} btreemap_v2_insert_blob_8_128: total: calls: 1 - instructions: 460891400 + instructions: 370623171 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_overwrite_u64_u64: total: calls: 1 - instructions: 361880515 + instructions: 296057608 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_overwrite_u64_u64_nocache: total: calls: 1 - instructions: 361439987 + instructions: 371438961 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_overwrite_zipf_10k_u64_u64: total: calls: 1 - instructions: 351678455 + instructions: 265045208 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_principal: total: calls: 1 - instructions: 504411405 + instructions: 397790991 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_seq_u64_u64: total: calls: 1 - instructions: 475747680 + instructions: 333906568 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_seq_u64_u64_nocache: total: calls: 1 - instructions: 475044736 + instructions: 472716458 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 408807071 + instructions: 352838177 heap_increase: 0 stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: calls: 1 - instructions: 416641538 + instructions: 356162259 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 412435236 + instructions: 351056169 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 595085830 + instructions: 434940532 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2745312743 + instructions: 2192230335 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1013486767 + instructions: 862859491 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 709962271 + instructions: 563612378 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1402961414 + instructions: 1181410426 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_0: total: calls: 1 - instructions: 622901933 + instructions: 510924354 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1183025750 + instructions: 1049358367 heap_increase: 0 stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 757068356 + instructions: 634848625 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 667248591 + instructions: 562776441 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 870137550 + instructions: 738460103 heap_increase: 0 stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 662703096 + instructions: 556986479 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 661403160 + instructions: 539343255 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 974550283 + instructions: 834725813 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 692676738 + instructions: 564203551 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 660889456 + instructions: 533050455 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 605196201 - heap_increase: 0 + instructions: 436367493 + heap_increase: 1 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1859866730 + instructions: 1567958241 heap_increase: 0 stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 847258662 + instructions: 722228540 heap_increase: 0 stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 667223395 + instructions: 528020057 heap_increase: 0 stable_memory_increase: 23 scopes: {} btreemap_v2_last_key_value_blob_256_128: total: calls: 1 - instructions: 150712776 + instructions: 150673373 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_last_key_value_blob_32_0: total: calls: 1 - instructions: 32538678 + instructions: 32536799 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_last_key_value_blob_32_1024: total: calls: 1 - instructions: 168949491 + instructions: 171435429 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_last_key_value_blob_32_128: total: calls: 1 - instructions: 122354174 + instructions: 125039249 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_last_key_value_blob_8_128: total: calls: 1 - instructions: 52855855 + instructions: 52843988 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_last_key_value_principal: total: calls: 1 - instructions: 32058181 + instructions: 76710295 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_last_key_value_u64_u64: total: calls: 1 - instructions: 81195505 + instructions: 86931340 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_last_key_value_vec_32_128: total: calls: 1 - instructions: 73273192 + instructions: 78201482 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_last_key_value_vec_32_vec128: total: calls: 1 - instructions: 73273192 + instructions: 78201482 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_blob512_u64: total: calls: 1 - instructions: 1643937985 + instructions: 1643830358 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_blob512: total: calls: 1 - instructions: 212669038 + instructions: 214214487 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_u64: total: calls: 1 - instructions: 213163935 + instructions: 213714676 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_vec512: total: calls: 1 - instructions: 276514725 + instructions: 277358190 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_vec512_u64: total: calls: 1 - instructions: 939857595 + instructions: 938767815 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_blob512_u64: total: calls: 1 - instructions: 3128614878 - heap_increase: 0 + instructions: 2319454087 + heap_increase: 1 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_blob512: total: calls: 1 - instructions: 608204362 + instructions: 534153431 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_u64: total: calls: 1 - instructions: 521480782 + instructions: 434571754 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_vec512: total: calls: 1 - instructions: 836012178 + instructions: 736566555 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: calls: 1 - instructions: 1966511677 + instructions: 1618293038 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_blob512_u64: total: calls: 1 - instructions: 4264053662 + instructions: 3524433860 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_blob512: total: calls: 1 - instructions: 879965338 + instructions: 822448050 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_u64: total: calls: 1 - instructions: 735887467 + instructions: 660790252 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_vec512: total: calls: 1 - instructions: 1219427655 + instructions: 1148510151 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_vec512_u64: total: calls: 1 - instructions: 3039345496 + instructions: 2753136803 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mixed_get_insert_zipf_10k_u64_u64: total: calls: 1 - instructions: 499914751 + instructions: 337367150 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mixed_get_insert_zipf_10k_u64_u64_nocache: total: calls: 1 - instructions: 568541315 + instructions: 576031481 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_peek_then_pop_first_u64_u64: total: calls: 1 - instructions: 612415506 + instructions: 451846877 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_peek_then_pop_last_u64_u64: total: calls: 1 - instructions: 596909726 + instructions: 445250519 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_peek_then_pop_last_u64_u64_nocache: total: calls: 1 - instructions: 696727719 + instructions: 701932179 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: calls: 1 - instructions: 1752818943 + instructions: 1451860053 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_0: total: calls: 1 - instructions: 518748769 + instructions: 398686459 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: calls: 1 - instructions: 851431505 + instructions: 761760182 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: calls: 1 - instructions: 617792608 + instructions: 482616093 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: calls: 1 - instructions: 439003841 + instructions: 337064290 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_principal: total: calls: 1 - instructions: 545962762 + instructions: 414634432 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: calls: 1 - instructions: 513282632 + instructions: 404184794 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 789544055 + instructions: 677735066 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_vec128: total: calls: 1 - instructions: 789544055 + instructions: 677735066 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: calls: 1 - instructions: 1658612907 + instructions: 1356341901 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_0: total: calls: 1 - instructions: 486831845 + instructions: 366514459 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: calls: 1 - instructions: 819931179 + instructions: 714422032 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: calls: 1 - instructions: 584383403 + instructions: 462413165 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 427149154 + instructions: 319261539 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_principal: total: calls: 1 - instructions: 527343866 + instructions: 387499419 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: calls: 1 - instructions: 489604710 + instructions: 390486139 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 766328757 + instructions: 656405996 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_vec128: total: calls: 1 - instructions: 766328757 + instructions: 656405996 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_0b: total: calls: 1 - instructions: 16962 + instructions: 17438 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_10kib: total: calls: 1 - instructions: 2507196 + instructions: 2403569 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1269,14 +1269,14 @@ benches: btreemap_v2_range_key_sum_1k_0b: total: calls: 1 - instructions: 16933 + instructions: 17409 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_10kib: total: calls: 1 - instructions: 2572994 + instructions: 2469367 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1290,21 +1290,21 @@ benches: btreemap_v2_range_small_u64_u64: total: calls: 1 - instructions: 18511700 + instructions: 18575496 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_0b: total: calls: 1 - instructions: 17300 + instructions: 17776 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_10kib: total: calls: 1 - instructions: 20668618 + instructions: 20796260 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1318,448 +1318,448 @@ benches: btreemap_v2_remove_100k_u64_u64: total: calls: 1 - instructions: 6934239178 + instructions: 6459956144 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_100k_u64_u64_nocache: total: calls: 1 - instructions: 6919819278 + instructions: 7007814665 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_10mib_values: total: calls: 1 - instructions: 4711743233 + instructions: 4705256210 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 585416459 + instructions: 494480126 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: calls: 1 - instructions: 7280230548 + instructions: 6125634073 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: calls: 1 - instructions: 1578192013 + instructions: 1337749920 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: calls: 1 - instructions: 665039226 + instructions: 586094449 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: calls: 1 - instructions: 2400178691 + instructions: 2005641441 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_0: total: calls: 1 - instructions: 654578268 + instructions: 590771254 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: calls: 1 - instructions: 981436308 + instructions: 941187011 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: calls: 1 - instructions: 745566132 + instructions: 655869991 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: calls: 1 - instructions: 699604173 + instructions: 625128260 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 782321020 + instructions: 700056800 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: calls: 1 - instructions: 711451431 + instructions: 624857798 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 696115676 + instructions: 617487671 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: calls: 1 - instructions: 855760433 + instructions: 800021230 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: calls: 1 - instructions: 736358929 + instructions: 654498983 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 695620819 + instructions: 614281188 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: calls: 1 - instructions: 453341383 + instructions: 373323149 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: calls: 1 - instructions: 4029563559 + instructions: 3406946939 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: calls: 1 - instructions: 906421907 + instructions: 811679791 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: calls: 1 - instructions: 599811841 + instructions: 520343675 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_principal: total: calls: 1 - instructions: 682445857 + instructions: 598900093 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 567554311 + instructions: 524277916 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: calls: 1 - instructions: 588118977 + instructions: 533948350 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_vec8: total: calls: 1 - instructions: 572766786 + instructions: 519927029 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 754547542 + instructions: 638942966 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4389758335 + instructions: 3955976774 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1405073079 + instructions: 1290393122 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 917676522 + instructions: 792212701 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2219301691 + instructions: 1974882757 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_0: total: calls: 1 - instructions: 831967364 + instructions: 740347933 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1689269104 + instructions: 1545910320 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1032868785 + instructions: 902750586 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 867682921 + instructions: 782529045 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1233221626 + instructions: 1109185713 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 864129124 + instructions: 771617799 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 858831537 + instructions: 772599254 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1397968704 + instructions: 1267880569 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 963345905 + instructions: 840262373 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 853023147 + instructions: 764575818 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 660778727 + instructions: 511552975 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 3036674847 + instructions: 2719139728 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1175810683 + instructions: 1040869622 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 819786629 + instructions: 700913260 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_zipf_10k_u64_u64: total: calls: 1 - instructions: 341014143 + instructions: 272321922 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_0b: total: calls: 1 - instructions: 975992 + instructions: 980927 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_10kib: total: calls: 1 - instructions: 2491763 + instructions: 2465246 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_20_10mib: total: calls: 1 - instructions: 18467176 + instructions: 18468649 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_0b: total: calls: 1 - instructions: 978166 + instructions: 980453 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_10kib: total: calls: 1 - instructions: 2475597 + instructions: 2452399 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_20_10mib: total: calls: 1 - instructions: 18467168 + instructions: 18468641 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_0b: total: calls: 1 - instructions: 982657 + instructions: 987592 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_10kib: total: calls: 1 - instructions: 2498428 + instructions: 2471911 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_20_10mib: total: calls: 1 - instructions: 18467320 + instructions: 18468793 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_0b: total: calls: 1 - instructions: 984223 + instructions: 986510 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_10kib: total: calls: 1 - instructions: 2481654 + instructions: 2458456 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_20_10mib: total: calls: 1 - instructions: 18467298 + instructions: 18468771 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_0b: total: calls: 1 - instructions: 1230992 + instructions: 1235927 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_10kib: total: calls: 1 - instructions: 56740279 + instructions: 56782402 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_20_10mib: total: calls: 1 - instructions: 1103710894 + instructions: 1103711407 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_0b: total: calls: 1 - instructions: 1231498 + instructions: 1233785 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_10kib: total: calls: 1 - instructions: 56683107 + instructions: 56751789 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_20_10mib: total: calls: 1 - instructions: 1103710405 + instructions: 1103710947 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/btreeset/canbench_results.yml b/benchmarks/btreeset/canbench_results.yml index 7031b5e1..0a080d40 100644 --- a/benchmarks/btreeset/canbench_results.yml +++ b/benchmarks/btreeset/canbench_results.yml @@ -2,700 +2,700 @@ benches: btreeset_insert_blob_1024: total: calls: 1 - instructions: 7266956788 + instructions: 4096762494 heap_increase: 1 stable_memory_increase: 256 scopes: {} btreeset_insert_blob_128: total: calls: 1 - instructions: 1637831818 + instructions: 994766949 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_16: total: calls: 1 - instructions: 716728742 + instructions: 452863495 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_256: total: calls: 1 - instructions: 2446289537 + instructions: 1462541977 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_32: total: calls: 1 - instructions: 815783126 + instructions: 528107224 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_512: total: calls: 1 - instructions: 4050903852 + instructions: 2310838642 heap_increase: 0 stable_memory_increase: 128 scopes: {} btreeset_insert_blob_64: total: calls: 1 - instructions: 981533677 + instructions: 624072231 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_8: total: calls: 1 - instructions: 695107777 + instructions: 431434924 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_u32: total: calls: 1 - instructions: 541229279 + instructions: 356067360 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_u64: total: calls: 1 - instructions: 562562358 + instructions: 380413243 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_1024: total: calls: 1 - instructions: 101680337 + instructions: 102069743 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_128: total: calls: 1 - instructions: 16712295 + instructions: 16715392 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_16: total: calls: 1 - instructions: 3049602 + instructions: 3057066 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_256: total: calls: 1 - instructions: 28981189 + instructions: 29311684 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_32: total: calls: 1 - instructions: 4315571 + instructions: 4317715 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_512: total: calls: 1 - instructions: 53201464 + instructions: 53621038 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_64: total: calls: 1 - instructions: 9211343 + instructions: 9209475 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_8: total: calls: 1 - instructions: 2793050 + instructions: 2791259 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_u32: total: calls: 1 - instructions: 1921673 + instructions: 1929170 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_u64: total: calls: 1 - instructions: 1964949 + instructions: 1966126 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_1024: total: calls: 1 - instructions: 43769567 + instructions: 44028549 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_128: total: calls: 1 - instructions: 7897406 + instructions: 7866415 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_16: total: calls: 1 - instructions: 1907832 + instructions: 1887062 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_256: total: calls: 1 - instructions: 13164529 + instructions: 13439142 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_32: total: calls: 1 - instructions: 2539466 + instructions: 2548675 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_512: total: calls: 1 - instructions: 23366500 + instructions: 23625705 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_64: total: calls: 1 - instructions: 4381408 + instructions: 4389180 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_8: total: calls: 1 - instructions: 1850635 + instructions: 1850978 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_u32: total: calls: 1 - instructions: 1316543 + instructions: 1300614 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_u64: total: calls: 1 - instructions: 1343356 + instructions: 1355443 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_1024: total: calls: 1 - instructions: 358419 + instructions: 360473 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_128: total: calls: 1 - instructions: 85062 + instructions: 85468 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_16: total: calls: 1 - instructions: 53155 + instructions: 54043 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_256: total: calls: 1 - instructions: 124179 + instructions: 126623 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_32: total: calls: 1 - instructions: 44795 + instructions: 44799 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_512: total: calls: 1 - instructions: 202259 + instructions: 204470 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_64: total: calls: 1 - instructions: 55209 + instructions: 55506 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_8: total: calls: 1 - instructions: 51777 + instructions: 53346 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_u32: total: calls: 1 - instructions: 42450 + instructions: 43614 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_u64: total: calls: 1 - instructions: 43256 + instructions: 44053 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_1024: total: calls: 1 - instructions: 78740555 + instructions: 78979443 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_128: total: calls: 1 - instructions: 13352888 + instructions: 13350129 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_16: total: calls: 1 - instructions: 2920490 + instructions: 2902902 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_256: total: calls: 1 - instructions: 23003003 + instructions: 23188089 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_32: total: calls: 1 - instructions: 4069766 + instructions: 4083042 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_512: total: calls: 1 - instructions: 41561193 + instructions: 41743303 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_64: total: calls: 1 - instructions: 7266779 + instructions: 7280466 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_8: total: calls: 1 - instructions: 2727094 + instructions: 2726274 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_u32: total: calls: 1 - instructions: 1921351 + instructions: 1919762 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_u64: total: calls: 1 - instructions: 1961281 + instructions: 1955901 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_1024: total: calls: 1 - instructions: 430995530 + instructions: 431626717 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_128: total: calls: 1 - instructions: 74503150 + instructions: 74347680 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_16: total: calls: 1 - instructions: 14579696 + instructions: 14603201 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_256: total: calls: 1 - instructions: 125787984 + instructions: 129387220 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_32: total: calls: 1 - instructions: 20939791 + instructions: 20847447 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_512: total: calls: 1 - instructions: 227475530 + instructions: 230367409 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_64: total: calls: 1 - instructions: 39453577 + instructions: 39259847 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_8: total: calls: 1 - instructions: 14004824 + instructions: 13838776 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_u32: total: calls: 1 - instructions: 10667867 + instructions: 10645096 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_u64: total: calls: 1 - instructions: 10908079 + instructions: 10781550 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_1024: total: calls: 1 - instructions: 259870196 + instructions: 259785932 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_128: total: calls: 1 - instructions: 45508439 + instructions: 45385642 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_16: total: calls: 1 - instructions: 9508605 + instructions: 9583941 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_256: total: calls: 1 - instructions: 76456411 + instructions: 78419986 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_32: total: calls: 1 - instructions: 13294157 + instructions: 13235727 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_512: total: calls: 1 - instructions: 137589173 + instructions: 139102127 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_64: total: calls: 1 - instructions: 24443488 + instructions: 24606935 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_8: total: calls: 1 - instructions: 9144616 + instructions: 9248058 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_u32: total: calls: 1 - instructions: 6480292 + instructions: 6609057 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_u64: total: calls: 1 - instructions: 6624379 + instructions: 6591868 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_1024: total: calls: 1 - instructions: 7723769472 - heap_increase: 0 + instructions: 4423467563 + heap_increase: 1 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_128: total: calls: 1 - instructions: 1667435780 + instructions: 1006751587 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_16: total: calls: 1 - instructions: 706481770 + instructions: 454200455 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_256: total: calls: 1 - instructions: 2535147032 + instructions: 1525976294 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_32: total: calls: 1 - instructions: 803118519 + instructions: 541084260 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_512: total: calls: 1 - instructions: 4262483247 - heap_increase: 0 + instructions: 2404488269 + heap_increase: 1 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_64: total: calls: 1 - instructions: 988152388 + instructions: 653155159 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_8: total: calls: 1 - instructions: 684602545 + instructions: 416027533 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_u32: total: calls: 1 - instructions: 529154304 + instructions: 349076873 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_u64: total: calls: 1 - instructions: 554060009 + instructions: 363543763 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_1024: total: calls: 1 - instructions: 101670997 + instructions: 102060403 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_128: total: calls: 1 - instructions: 16692203 + instructions: 16695300 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_16: total: calls: 1 - instructions: 3027274 + instructions: 3034738 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_256: total: calls: 1 - instructions: 28962633 + instructions: 29293128 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_32: total: calls: 1 - instructions: 4281313 + instructions: 4283457 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_512: total: calls: 1 - instructions: 53185980 + instructions: 53605554 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_64: total: calls: 1 - instructions: 9190483 + instructions: 9188615 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_8: total: calls: 1 - instructions: 2776181 + instructions: 2774390 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_u32: total: calls: 1 - instructions: 1901309 + instructions: 1908806 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_u64: total: calls: 1 - instructions: 1935566 + instructions: 1936743 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_1024: total: calls: 1 - instructions: 101691006 + instructions: 102080412 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_128: total: calls: 1 - instructions: 16712212 + instructions: 16715309 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_16: total: calls: 1 - instructions: 3047765 + instructions: 3055229 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_256: total: calls: 1 - instructions: 28982642 + instructions: 29313137 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_32: total: calls: 1 - instructions: 4313788 + instructions: 4315932 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_512: total: calls: 1 - instructions: 53205989 + instructions: 53625563 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_64: total: calls: 1 - instructions: 9210492 + instructions: 9208624 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_8: total: calls: 1 - instructions: 2791177 + instructions: 2789386 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_u32: total: calls: 1 - instructions: 1900823 + instructions: 1908320 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_u64: total: calls: 1 - instructions: 1969072 + instructions: 1970249 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/io_chunks/canbench_results.yml b/benchmarks/io_chunks/canbench_results.yml index 4112f5c6..d406ece9 100644 --- a/benchmarks/io_chunks/canbench_results.yml +++ b/benchmarks/io_chunks/canbench_results.yml @@ -65,21 +65,21 @@ benches: write_chunks_btreemap_1: total: calls: 1 - instructions: 357205465 + instructions: 357205395 heap_increase: 13 stable_memory_increase: 1536 scopes: {} write_chunks_btreemap_1k: total: calls: 1 - instructions: 4187223807 + instructions: 3921144695 heap_increase: 2 stable_memory_increase: 1536 scopes: {} write_chunks_btreemap_1m: total: calls: 1 - instructions: 83761099339 + instructions: 53667232586 heap_increase: 0 stable_memory_increase: 3072 scopes: {} @@ -107,21 +107,21 @@ benches: write_chunks_vec_1: total: calls: 1 - instructions: 549903461 + instructions: 549903446 heap_increase: 0 stable_memory_increase: 1536 scopes: {} write_chunks_vec_1k: total: calls: 1 - instructions: 562145515 + instructions: 562132513 heap_increase: 0 stable_memory_increase: 1536 scopes: {} write_chunks_vec_1m: total: calls: 1 - instructions: 1784593101 + instructions: 1771593099 heap_increase: 0 stable_memory_increase: 1536 scopes: {} diff --git a/benchmarks/nns/canbench_results.yml b/benchmarks/nns/canbench_results.yml index 95d38b97..694a2443 100644 --- a/benchmarks/nns/canbench_results.yml +++ b/benchmarks/nns/canbench_results.yml @@ -58,56 +58,56 @@ benches: vote_cascading_stable_centralized_10k: total: calls: 1 - instructions: 1372396240 + instructions: 1361124087 heap_increase: 10 stable_memory_increase: 0 scopes: {} vote_cascading_stable_centralized_1k: total: calls: 1 - instructions: 99761831 + instructions: 99953937 heap_increase: 1 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_10k_15: total: calls: 1 - instructions: 9854978344 + instructions: 9747582279 heap_increase: 5 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_10k_5: total: calls: 1 - instructions: 2924577184 + instructions: 2896435872 heap_increase: 5 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_1k_15: total: calls: 1 - instructions: 866392564 - heap_increase: 0 + instructions: 866417732 + heap_increase: 1 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_1k_5: total: calls: 1 - instructions: 251866705 - heap_increase: 0 + instructions: 248615294 + heap_increase: 1 stable_memory_increase: 0 scopes: {} vote_cascading_stable_single_vote_10k: total: calls: 1 - instructions: 91198 + instructions: 92582 heap_increase: 0 stable_memory_increase: 0 scopes: {} vote_cascading_stable_single_vote_1k: total: calls: 1 - instructions: 66620 + instructions: 68060 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/src/btreemap.rs b/src/btreemap.rs index c67fcf00..afdf6547 100644 --- a/src/btreemap.rs +++ b/src/btreemap.rs @@ -666,7 +666,7 @@ where node } else { // Load the root from memory. - let mut root = self.load_node(self.root_addr); + let mut root = self.take_or_load_node(self.root_addr); // Check if the key already exists in the root. if let Ok(idx) = root.search(&key, self.memory()) { @@ -693,7 +693,7 @@ where self.save_header(); // Split the old (full) root. - self.split_child(&mut new_root, 0); + self.split_child(&mut new_root, 0, None); new_root } else { @@ -701,13 +701,19 @@ where } }; - self.insert_nonfull(root, key, value) + self.insert_nonfull(root, key, value, 0) .map(Cow::Owned) .map(V::from_bytes) } /// Inserts an entry into a node that is *not full*. - fn insert_nonfull(&mut self, mut node: Node, key: K, value: Vec) -> Option> { + fn insert_nonfull( + &mut self, + mut node: Node, + key: K, + value: Vec, + depth: u8, + ) -> Option> { // We're guaranteed by the caller that the provided node is not full. assert!(!node.is_full()); @@ -737,28 +743,36 @@ where NodeType::Internal => { // The node is an internal node. // Load the child that we should add the entry to. - let mut child = self.load_node(node.child(idx)); + let mut child = self.take_or_load_node(node.child(idx)); + let child_depth = depth.saturating_add(1); if child.is_full() { // Check if the key already exists in the child. if let Ok(idx) = child.search(&key, self.memory()) { // Key found, replace its value and return the old one. + // The parent node is unmodified — return it to cache. + self.return_node(node, depth); return Some(self.update_value(&mut child, idx, value)); } // The child is full. Split the child. - self.split_child(&mut node, idx); + // Pass the already-loaded child to avoid a redundant load. + self.split_child(&mut node, idx, Some(child)); // The children have now changed. Search again for // the child where we need to store the entry in. let idx = node.search(&key, self.memory()).unwrap_or_else(|idx| idx); child = self.load_node(node.child(idx)); + } else { + // Happy path: child is not full. The current node + // will not be modified — return it to cache. + self.return_node(node, depth); } // The child should now be not full. assert!(!child.is_full()); - self.insert_nonfull(child, key, value) + self.insert_nonfull(child, key, value, child_depth) } } } @@ -782,12 +796,18 @@ where /// [ N O P Q R ] [ T U V W X ] /// ``` /// - fn split_child(&mut self, node: &mut Node, full_child_idx: usize) { + fn split_child( + &mut self, + node: &mut Node, + full_child_idx: usize, + full_child: Option>, + ) { // The node must not be full. assert!(!node.is_full()); - // The node's child must be full. - let mut full_child = self.load_node(node.child(full_child_idx)); + // Use the pre-loaded child if provided, otherwise load from memory. + let mut full_child = + full_child.unwrap_or_else(|| self.load_node(node.child(full_child_idx))); assert!(full_child.is_full()); // Create a sibling to this full child (which has to be the same type). @@ -885,13 +905,15 @@ where } #[inline(always)] - fn first_entry_inner(&self, node: &Node) -> Entry { - self.find_first_or_last(node, true, 0, |n, i, m| n.get_key_read_value_uncached(i, m)) + fn first_entry_inner(&self, node: &Node, depth: u8) -> Entry { + self.find_first_or_last(node, true, depth, |n, i, m| { + n.get_key_read_value_uncached(i, m) + }) } #[inline(always)] - fn last_entry_inner(&self, node: &Node) -> Entry { - self.find_first_or_last(node, false, 0, |n, i, m| { + fn last_entry_inner(&self, node: &Node, depth: u8) -> Entry { + self.find_first_or_last(node, false, depth, |n, i, m| { n.get_key_read_value_uncached(i, m) }) } @@ -939,7 +961,7 @@ where return None; } let root = self.take_or_load_node(self.root_addr); - let (k, encoded_v) = self.first_entry_inner(&root); + let (k, encoded_v) = self.first_entry_inner(&root, 0); self.return_node(root, 0); Some((k, V::from_bytes(Cow::Owned(encoded_v)))) } @@ -951,7 +973,7 @@ where return None; } let root = self.take_or_load_node(self.root_addr); - let (k, encoded_v) = self.last_entry_inner(&root); + let (k, encoded_v) = self.last_entry_inner(&root, 0); self.return_node(root, 0); Some((k, V::from_bytes(Cow::Owned(encoded_v)))) } @@ -970,8 +992,8 @@ where return None; } - let root_node = self.load_node(self.root_addr); - self.remove_helper(root_node, key) + let root_node = self.take_or_load_node(self.root_addr); + self.remove_helper(root_node, key, 0) .map(Cow::Owned) .map(V::from_bytes) } @@ -982,8 +1004,8 @@ where return None; } - let root = self.load_node(self.root_addr); - self.remove_rightmost(root) + let root = self.take_or_load_node(self.root_addr); + self.remove_rightmost(root, 0) .map(|(k, v)| (k, V::from_bytes(Cow::Owned(v)))) } @@ -993,13 +1015,13 @@ where return None; } - let root = self.load_node(self.root_addr); - self.remove_leftmost(root) + let root = self.take_or_load_node(self.root_addr); + self.remove_leftmost(root, 0) .map(|(k, v)| (k, V::from_bytes(Cow::Owned(v)))) } /// A helper method for recursively removing a key from the B-tree. - fn remove_helper(&mut self, mut node: Node, key: &K) -> Option> { + fn remove_helper(&mut self, mut node: Node, key: &K, depth: u8) -> Option> { if node.address() != self.root_addr { // We're guaranteed that whenever this method is called an entry can be // removed from the node without it needing to be merged into a sibling. @@ -1033,7 +1055,11 @@ where self.save_header(); Some(value) } - _ => None, // Key not found. + _ => { + // Key not found. Return the unmodified node to cache. + self.return_node(node, depth); + None + } } } NodeType::Internal => { @@ -1041,7 +1067,7 @@ where Ok(idx) => { // Case 2: The node is an internal node and the key exists in it. - let left_child = self.load_node(node.child(idx)); + let left_child = self.take_or_load_node(node.child(idx)); if left_child.can_remove_entry_without_merging() { // Case 2.a: A key can be removed from the left child without merging. // @@ -1064,7 +1090,8 @@ where // [...] [...] // Remove the predecessor in a single pass (no double traversal). - let predecessor = self.remove_rightmost(left_child)?; + let predecessor = + self.remove_rightmost(left_child, depth.saturating_add(1))?; // Replace the `key` with its predecessor. let (_, old_value) = node.swap_entry(idx, predecessor, self.memory()); @@ -1074,7 +1101,7 @@ where return Some(old_value); } - let right_child = self.load_node(node.child(idx + 1)); + let right_child = self.take_or_load_node(node.child(idx + 1)); if right_child.can_remove_entry_without_merging() { // Case 2.b: A key can be removed from the right child without merging. // @@ -1096,8 +1123,12 @@ where // / \ // [...] [...] + // Return the unmodified left child to the cache. + self.return_node(left_child, depth.saturating_add(1)); + // Remove the successor in a single pass (no double traversal). - let successor = self.remove_leftmost(right_child)?; + let successor = + self.remove_leftmost(right_child, depth.saturating_add(1))?; // Replace the `key` with its successor. let (_, old_value) = node.swap_entry(idx, successor, self.memory()); @@ -1157,23 +1188,28 @@ where self.save_node(&mut new_child); // Recursively delete the key. - self.remove_helper(new_child, key) + self.remove_helper(new_child, key, depth.saturating_add(1)) } Err(idx) => { // Case 3: The node is an internal node and the key does NOT exist in it. // If the key does exist in the tree, it will exist in the subtree at index // `idx`. - let mut child = self.load_node(node.child(idx)); + let mut child = self.take_or_load_node(node.child(idx)); + let child_depth = depth.saturating_add(1); if child.can_remove_entry_without_merging() { // The child has enough nodes. Recurse to delete the `key` from the // `child`. - return self.remove_helper(child, key); + // The current node is not modified — return it to cache. + self.return_node(node, depth); + return self.remove_helper(child, key, child_depth); } // An entry can't be removed from the child without merging. // See if it has a sibling where an entry can be removed without merging. + // Siblings are loaded without cache: all rebalancing paths modify + // and save every loaded node, so caching them would be wasted. let mut left_sibling = if idx > 0 { Some(self.load_node(node.child(idx - 1))) } else { @@ -1237,7 +1273,7 @@ where self.save_node(left_sibling); self.save_node(&mut child); self.save_node(&mut node); - return self.remove_helper(child, key); + return self.remove_helper(child, key, child_depth); } } @@ -1292,7 +1328,7 @@ where self.save_node(right_sibling); self.save_node(&mut child); self.save_node(&mut node); - return self.remove_helper(child, key); + return self.remove_helper(child, key, child_depth); } } @@ -1323,7 +1359,7 @@ where self.save_node(&mut node); } - return self.remove_helper(left_sibling, key); + return self.remove_helper(left_sibling, key, child_depth); } if let Some(right_sibling) = right_sibling { @@ -1352,7 +1388,7 @@ where self.save_node(&mut node); } - return self.remove_helper(right_sibling, key); + return self.remove_helper(right_sibling, key, child_depth); } unreachable!("At least one of the siblings must exist."); @@ -1365,7 +1401,7 @@ where /// Removes and returns the rightmost (maximum) entry in the subtree rooted /// at `node`, in a single top-down pass. This avoids the double traversal /// of the previous approach (get_max + remove_helper). - fn remove_rightmost(&mut self, mut node: Node) -> Option> { + fn remove_rightmost(&mut self, mut node: Node, depth: u8) -> Option> { match node.node_type() { NodeType::Leaf => { let entry = node.pop_entry(self.memory())?; @@ -1383,18 +1419,24 @@ where } NodeType::Internal => { let last_idx = node.children_len() - 1; - let mut child = self.load_node(node.child(last_idx)); + let child_depth = depth.saturating_add(1); + let child = self.take_or_load_node(node.child(last_idx)); if child.can_remove_entry_without_merging() { - return self.remove_rightmost(child); + // The current node is not modified — return it to cache. + self.return_node(node, depth); + return self.remove_rightmost(child, child_depth); } // The rightmost child is at minimum. Steal from its left sibling or merge. + // Siblings are loaded without cache: all rebalancing paths modify + // and save every loaded node, so caching them would be wasted. let left_sibling_idx = last_idx - 1; let mut left_sibling = self.load_node(node.child(left_sibling_idx)); if left_sibling.can_remove_entry_without_merging() { // Rotate right: left_sibling -> parent -> child + let mut child = child; let (left_key, left_value) = left_sibling.pop_entry(self.memory()).unwrap(); let (parent_key, parent_value) = node.swap_entry(last_idx - 1, (left_key, left_value), self.memory()); @@ -1407,7 +1449,7 @@ where self.save_node(&mut left_sibling); self.save_node(&mut child); self.save_node(&mut node); - return self.remove_rightmost(child); + return self.remove_rightmost(child, child_depth); } // Both at minimum: merge child into left sibling. @@ -1427,14 +1469,14 @@ where self.save_node(&mut node); } - self.remove_rightmost(merged) + self.remove_rightmost(merged, child_depth) } } } /// Removes and returns the leftmost (minimum) entry in the subtree rooted /// at `node`, in a single top-down pass. - fn remove_leftmost(&mut self, mut node: Node) -> Option> { + fn remove_leftmost(&mut self, mut node: Node, depth: u8) -> Option> { match node.node_type() { NodeType::Leaf => { if node.entries_len() == 0 { @@ -1454,17 +1496,23 @@ where Some(entry) } NodeType::Internal => { - let mut child = self.load_node(node.child(0)); + let child_depth = depth.saturating_add(1); + let child = self.take_or_load_node(node.child(0)); if child.can_remove_entry_without_merging() { - return self.remove_leftmost(child); + // The current node is not modified — return it to cache. + self.return_node(node, depth); + return self.remove_leftmost(child, child_depth); } // The leftmost child is at minimum. Steal from its right sibling or merge. + // Siblings are loaded without cache: all rebalancing paths modify + // and save every loaded node, so caching them would be wasted. let mut right_sibling = self.load_node(node.child(1)); if right_sibling.can_remove_entry_without_merging() { // Rotate left: right_sibling -> parent -> child + let mut child = child; let (right_key, right_value) = right_sibling.remove_entry(0, self.memory()); let parent_entry = node.swap_entry(0, (right_key, right_value), self.memory()); child.push_entry(parent_entry); @@ -1476,7 +1524,7 @@ where self.save_node(&mut right_sibling); self.save_node(&mut child); self.save_node(&mut node); - return self.remove_leftmost(child); + return self.remove_leftmost(child, child_depth); } // Both at minimum: merge child into right sibling. @@ -1492,7 +1540,7 @@ where self.save_node(&mut node); } - self.remove_leftmost(merged) + self.remove_leftmost(merged, child_depth) } } } @@ -1674,6 +1722,9 @@ where } /// Saves the node to memory and invalidates the cache slot. + // TODO: benchmark putting the node back into the cache after saving + // instead of invalidating, so subsequent reads (especially of the root + // and depth-1 nodes) hit the cache. Requires cloning or taking ownership. #[inline] fn save_node(&mut self, node: &mut Node) { node.save(self.allocator_mut()); diff --git a/src/btreemap/node_cache.rs b/src/btreemap/node_cache.rs index c4eb1d2c..f2717aac 100644 --- a/src/btreemap/node_cache.rs +++ b/src/btreemap/node_cache.rs @@ -91,6 +91,9 @@ struct CacheSlot { node: Option>, /// Distance from the tree root (root = 0). Used by the eviction policy. + /// u8 is sufficient: with B=6 (min 6 children per node), a depth-255 + /// tree holds at least 2*6^254 entries (~10^197), far beyond any + /// practical stable memory size. depth: u8, }