diff --git a/canbench_results.yml b/canbench_results.yml index c39ecb9d..ea633ec7 100644 --- a/canbench_results.yml +++ b/canbench_results.yml @@ -1,1711 +1,1711 @@ benches: btreemap_v2_contains_10mib_values: total: - instructions: 142205766 + instructions: 142209880 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob8_u64: total: - instructions: 277713087 + instructions: 283243183 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_1024_128: total: - instructions: 4897884819 + instructions: 4294894389 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_128_128: total: - instructions: 925983020 + instructions: 840909873 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_16_128: total: - instructions: 304185180 + instructions: 300105733 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_256_128: total: - instructions: 1482592583 + instructions: 1326771398 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_1024: total: - instructions: 334889492 + instructions: 337445347 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_128: total: - instructions: 332336378 + instructions: 337242954 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_16: total: - instructions: 336647532 + instructions: 329500226 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_256: total: - instructions: 336952134 + instructions: 335682006 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_32: total: - instructions: 337767804 + instructions: 342487364 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_4: total: - instructions: 333734209 + instructions: 333741837 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_512: total: - instructions: 332809414 + instructions: 333192026 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_64: total: - instructions: 335145674 + instructions: 337617770 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_8: total: - instructions: 334699459 + instructions: 335387692 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_4_128: total: - instructions: 244876846 + instructions: 250355527 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_512_128: total: - instructions: 2624677444 + instructions: 2298434688 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_64_128: total: - instructions: 584178824 + instructions: 419606571 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_8_128: total: - instructions: 268359561 + instructions: 273336144 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_u64_blob8: total: - instructions: 220415166 + instructions: 225499208 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_u64_u64: total: - instructions: 221971411 + instructions: 230729848 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_u64_vec8: total: - instructions: 220415181 + instructions: 225499208 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec8_u64: total: - instructions: 366198881 + instructions: 373974676 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_1024_128: total: - instructions: 2875330977 + instructions: 1847543840 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_128_128: total: - instructions: 697749792 + instructions: 562946694 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_16_128: total: - instructions: 430197715 + instructions: 432781516 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_256_128: total: - instructions: 1219777744 + instructions: 916951502 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_1024: total: - instructions: 573496205 + instructions: 516345705 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_128: total: - instructions: 488301624 + instructions: 437597036 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_16: total: - instructions: 408003935 + instructions: 367092393 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_256: total: - instructions: 521575504 + instructions: 445726842 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_32: total: - instructions: 408501502 + instructions: 367166160 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_4: total: - instructions: 406876890 + instructions: 366267455 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_512: total: - instructions: 536695503 + instructions: 480959844 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_64: total: - instructions: 463298379 + instructions: 407119034 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_8: total: - instructions: 406799819 + instructions: 366285310 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_4_128: total: - instructions: 396852340 + instructions: 398219520 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_512_128: total: - instructions: 1811992062 + instructions: 1276595168 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_64_128: total: - instructions: 594419422 + instructions: 512370487 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_8_128: total: - instructions: 388565162 + instructions: 398244276 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_10mib_values: total: - instructions: 388591561 + instructions: 388595739 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob8_u64: total: - instructions: 296039913 + instructions: 294497961 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_1024_128: total: - instructions: 4995374210 + instructions: 4434041250 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_128_128: total: - instructions: 952796495 + instructions: 874096441 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_16_128: total: - instructions: 317134417 + instructions: 313526176 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_256_128: total: - instructions: 1518161266 + instructions: 1373148627 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_1024: total: - instructions: 353696221 + instructions: 357155878 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_128: total: - instructions: 345834163 + instructions: 351535569 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_16: total: - instructions: 346893462 + instructions: 340461035 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_256: total: - instructions: 351520221 + instructions: 351061574 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_32: total: - instructions: 348829561 + instructions: 353942156 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_4: total: - instructions: 343413664 + instructions: 343418309 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_512: total: - instructions: 348869751 + instructions: 350194694 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_64: total: - instructions: 347059635 + instructions: 350423633 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_8: total: - instructions: 345255038 + instructions: 345686331 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_4_128: total: - instructions: 256930621 + instructions: 262413917 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_512_128: total: - instructions: 2680882132 + instructions: 2375697184 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_64_128: total: - instructions: 604824814 + instructions: 443018383 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_8_128: total: - instructions: 281380219 + instructions: 286466147 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_u64_blob8: total: - instructions: 230440052 + instructions: 235941204 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_u64_u64: total: - instructions: 233538450 + instructions: 242257564 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_u64_vec8: total: - instructions: 231215276 + instructions: 236688728 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec8_u64: total: - instructions: 375465738 + instructions: 383633028 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_1024_128: total: - instructions: 2921388781 + instructions: 1895892018 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_128_128: total: - instructions: 710260607 + instructions: 575182488 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_16_128: total: - instructions: 439839416 + instructions: 442328777 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_256_128: total: - instructions: 1232799294 + instructions: 929706176 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_1024: total: - instructions: 605868780 + instructions: 558668775 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_128: total: - instructions: 498346422 + instructions: 447698376 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_16: total: - instructions: 416385722 + instructions: 374638989 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_256: total: - instructions: 539258417 + instructions: 463244746 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_32: total: - instructions: 416455381 + instructions: 374845452 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_4: total: - instructions: 414556101 + instructions: 374022126 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_512: total: - instructions: 558220558 + instructions: 502894637 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_64: total: - instructions: 471617224 + instructions: 415510235 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_8: total: - instructions: 414516893 + instructions: 374044538 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_4_128: total: - instructions: 406495487 + instructions: 407171463 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_512_128: total: - instructions: 1825137226 + instructions: 1289217052 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_64_128: total: - instructions: 605631892 + instructions: 523089680 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_8_128: total: - instructions: 398111188 + instructions: 407684848 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_10mib_values: total: - instructions: 5235938163 + instructions: 5235942268 heap_increase: 322 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: - instructions: 441904168 + instructions: 447881281 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: - instructions: 5105502838 + instructions: 5522417615 heap_increase: 0 stable_memory_increase: 196 scopes: {} btreemap_v2_insert_blob_128_128: total: - instructions: 1135854893 + instructions: 1205447826 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: - instructions: 496764107 + instructions: 497322694 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: - instructions: 1686027747 + instructions: 1814060369 heap_increase: 0 stable_memory_increase: 67 scopes: {} btreemap_v2_insert_blob_32_1024: total: - instructions: 689280923 + instructions: 721539147 heap_increase: 0 stable_memory_increase: 173 scopes: {} btreemap_v2_insert_blob_32_128: total: - instructions: 531276303 + instructions: 560214330 heap_increase: 0 stable_memory_increase: 28 scopes: {} btreemap_v2_insert_blob_32_16: total: - instructions: 510603697 + instructions: 536081224 heap_increase: 0 stable_memory_increase: 11 scopes: {} btreemap_v2_insert_blob_32_256: total: - instructions: 562470458 + instructions: 589601127 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: - instructions: 516197300 + instructions: 546883904 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: - instructions: 498764491 + instructions: 526741522 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: - instructions: 599721924 + instructions: 628023289 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: - instructions: 521846397 + instructions: 553130892 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: - instructions: 505902273 + instructions: 535393971 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: - instructions: 411923969 + instructions: 418057064 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_512_128: total: - instructions: 2857199517 + instructions: 3066989201 heap_increase: 0 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: - instructions: 779936995 + instructions: 683865403 heap_increase: 0 stable_memory_increase: 34 scopes: {} btreemap_v2_insert_blob_8_128: total: - instructions: 464074295 + instructions: 469975063 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_u64_blob8: total: - instructions: 409371990 + instructions: 422220035 heap_increase: 0 stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: - instructions: 418356354 + instructions: 430448129 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: - instructions: 416646691 + instructions: 430971218 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: - instructions: 582567628 + instructions: 593488226 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: - instructions: 3320016640 + instructions: 2788964013 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: - instructions: 1096598029 + instructions: 1040666127 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: - instructions: 704045105 + instructions: 716528048 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: - instructions: 1507625753 + instructions: 1423229579 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_1024: total: - instructions: 1222990248 + instructions: 1241911609 heap_increase: 0 stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: - instructions: 762468172 + instructions: 780562374 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: - instructions: 663941968 + instructions: 685367835 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: - instructions: 891379346 + instructions: 905182779 heap_increase: 0 stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: - instructions: 666836676 + instructions: 681093828 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: - instructions: 661014217 + instructions: 680050783 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: - instructions: 1009791311 + instructions: 1023501139 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: - instructions: 692793122 + instructions: 713787802 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: - instructions: 660781147 + instructions: 679379848 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: - instructions: 609473881 + instructions: 618554697 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: - instructions: 2128736325 + instructions: 1900951170 heap_increase: 0 stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: - instructions: 881141840 + instructions: 871501114 heap_increase: 0 stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: - instructions: 667087649 + instructions: 677475745 heap_increase: 0 stable_memory_increase: 23 scopes: {} btreemap_v2_mem_manager_contains_blob512_u64: total: - instructions: 2717630382 + instructions: 2393561728 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_contains_u64_blob512: total: - instructions: 296668292 + instructions: 301490927 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_contains_u64_u64: total: - instructions: 302298066 + instructions: 306649304 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_contains_u64_vec512: total: - instructions: 380632038 + instructions: 390370858 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_contains_vec512_u64: total: - instructions: 1751810053 + instructions: 1262177337 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_blob512_u64: total: - instructions: 2782777145 + instructions: 2480010674 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_blob512: total: - instructions: 312986175 + instructions: 318984419 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_u64: total: - instructions: 314050372 + instructions: 319774791 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_vec512: total: - instructions: 407060000 + instructions: 417383478 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_vec512_u64: total: - instructions: 1788274093 + instructions: 1305921836 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_blob512_u64: total: - instructions: 2962196009 + instructions: 3188220437 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_blob512: total: - instructions: 633935946 + instructions: 646180538 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_u64: total: - instructions: 547687687 + instructions: 559686196 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_vec512: total: - instructions: 887505369 + instructions: 900244746 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: - instructions: 2238675735 + instructions: 2030007104 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_blob512_u64: total: - instructions: 3913176508 + instructions: 4409760599 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_blob512: total: - instructions: 933112094 + instructions: 948683605 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_u64: total: - instructions: 792963230 + instructions: 806471492 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_vec512: total: - instructions: 1271172770 + instructions: 1288322168 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_vec512_u64: total: - instructions: 3314692170 + instructions: 3180357322 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob8_u64: total: - instructions: 609874035 + instructions: 618149965 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_1024_128: total: - instructions: 9515561561 + instructions: 8426240976 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_128_128: total: - instructions: 2030770067 + instructions: 1863629590 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_16_128: total: - instructions: 759809597 + instructions: 761301140 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: - instructions: 3136633439 + instructions: 2801910688 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: - instructions: 1135813034 + instructions: 1146780971 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: - instructions: 879754618 + instructions: 890225887 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_16: total: - instructions: 823288744 + instructions: 825218804 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_256: total: - instructions: 910872808 + instructions: 918990755 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_32: total: - instructions: 835124401 + instructions: 839977694 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_4: total: - instructions: 805506792 + instructions: 808460660 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_512: total: - instructions: 976616577 + instructions: 983671503 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_64: total: - instructions: 842029077 + instructions: 848705110 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_8: total: - instructions: 821861603 + instructions: 826773859 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_4_128: total: - instructions: 373215107 + instructions: 380309990 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_512_128: total: - instructions: 5253856494 + instructions: 4651382667 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_64_128: total: - instructions: 1342523431 + instructions: 1065173359 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: - instructions: 613229459 + instructions: 622213520 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_blob8: total: - instructions: 680849585 + instructions: 700537150 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: - instructions: 693078421 + instructions: 712190273 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_vec8: total: - instructions: 685131066 + instructions: 703089020 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec8_u64: total: - instructions: 783315453 + instructions: 794337993 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_1024_128: total: - instructions: 5765642368 + instructions: 4084712198 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_128_128: total: - instructions: 1817945546 + instructions: 1536344151 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_16_128: total: - instructions: 1025977623 + instructions: 1034269421 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_256_128: total: - instructions: 2531258700 + instructions: 2054975331 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_1024: total: - instructions: 1813667702 + instructions: 1715732916 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: - instructions: 1206539580 + instructions: 1116978776 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_16: total: - instructions: 1040807541 + instructions: 960050241 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_256: total: - instructions: 1328565779 + instructions: 1243756132 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_32: total: - instructions: 1057002665 + instructions: 956192431 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_4: total: - instructions: 1039757290 + instructions: 949470088 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_512: total: - instructions: 1492074658 + instructions: 1399777559 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_64: total: - instructions: 1091266495 + instructions: 1000150610 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_8: total: - instructions: 1051685356 + instructions: 960712444 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_4_128: total: - instructions: 538301544 + instructions: 543972754 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_512_128: total: - instructions: 3602527844 + instructions: 2753463277 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_64_128: total: - instructions: 1403820790 + instructions: 1261402194 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_8_128: total: - instructions: 846811612 + instructions: 855954019 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob8_u64: total: - instructions: 593959731 + instructions: 598288574 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_1024_128: total: - instructions: 9323255555 + instructions: 8109415496 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_128_128: total: - instructions: 1980262871 + instructions: 1797385897 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_16_128: total: - instructions: 740958574 + instructions: 737329012 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: - instructions: 3060069005 + instructions: 2713198089 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: - instructions: 1115727081 + instructions: 1112675292 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: - instructions: 857533960 + instructions: 857685748 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_16: total: - instructions: 802001112 + instructions: 800650933 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_256: total: - instructions: 889828827 + instructions: 890480209 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_32: total: - instructions: 814095431 + instructions: 810590785 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_4: total: - instructions: 791004452 + instructions: 788644075 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_512: total: - instructions: 958373138 + instructions: 960247599 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_64: total: - instructions: 823785159 + instructions: 824986291 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_8: total: - instructions: 801067339 + instructions: 802282038 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_4_128: total: - instructions: 364836523 + instructions: 368947012 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_512_128: total: - instructions: 5128357778 + instructions: 4491955816 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_64_128: total: - instructions: 1319856368 + instructions: 1036824265 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: - instructions: 613014472 + instructions: 618217334 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_blob8: total: - instructions: 668402753 + instructions: 681642507 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: - instructions: 680229470 + instructions: 693044274 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_vec8: total: - instructions: 671449682 + instructions: 683926309 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec8_u64: total: - instructions: 764632330 + instructions: 771729448 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_1024_128: total: - instructions: 6013195562 + instructions: 4311367464 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_128_128: total: - instructions: 1831799415 + instructions: 1550311560 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_16_128: total: - instructions: 1014148555 + instructions: 1021597436 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_256_128: total: - instructions: 2584522543 + instructions: 2128674539 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_1024: total: - instructions: 1808452255 + instructions: 1698447535 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: - instructions: 1205715175 + instructions: 1098011297 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_16: total: - instructions: 1029643856 + instructions: 939250020 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_256: total: - instructions: 1325990822 + instructions: 1226704397 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_32: total: - instructions: 1045332009 + instructions: 938142634 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_4: total: - instructions: 1038073629 + instructions: 935353100 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_512: total: - instructions: 1492336097 + instructions: 1390117044 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_64: total: - instructions: 1086012022 + instructions: 981585565 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_8: total: - instructions: 1039859226 + instructions: 938800934 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_4_128: total: - instructions: 529420356 + instructions: 533817212 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_512_128: total: - instructions: 3725438908 + instructions: 2873026098 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_64_128: total: - instructions: 1417283058 + instructions: 1254022302 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_8_128: total: - instructions: 854405408 + instructions: 861806611 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_0b: total: - instructions: 16116 + instructions: 16742 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_10kib: total: - instructions: 2430698 + instructions: 2599668 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_20_10mib: total: - instructions: 20572085 + instructions: 20576282 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_0b: total: - instructions: 16636 + instructions: 17104 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_10kib: total: - instructions: 57223447 + instructions: 57215658 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_20_10mib: total: - instructions: 1105825157 + instructions: 1105826200 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_0b: total: - instructions: 16650 + instructions: 17118 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_10kib: total: - instructions: 57235443 + instructions: 57227654 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_20_10mib: total: - instructions: 1105825393 + instructions: 1105826436 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_10mib_values: total: - instructions: 4722303381 + instructions: 4722318553 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: - instructions: 589502787 + instructions: 600630132 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: - instructions: 6553234349 + instructions: 7415359343 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: - instructions: 1485392969 + instructions: 1628874474 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: - instructions: 682777009 + instructions: 684610503 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: - instructions: 2229763117 + instructions: 2462815709 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: - instructions: 969273766 + instructions: 1011836417 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: - instructions: 734489062 + instructions: 776121815 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: - instructions: 690598257 + instructions: 729483435 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: - instructions: 769372662 + instructions: 812632815 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: - instructions: 699409003 + instructions: 740922807 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: - instructions: 682743585 + instructions: 725865405 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: - instructions: 841345948 + instructions: 885071370 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: - instructions: 723470415 + instructions: 767661424 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: - instructions: 683374771 + instructions: 725879178 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: - instructions: 457076310 + instructions: 464283644 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: - instructions: 3665801196 + instructions: 4116359190 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: - instructions: 1031492525 + instructions: 944002054 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: - instructions: 610204657 + instructions: 617996656 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: - instructions: 583411497 + instructions: 596635327 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: - instructions: 604748819 + instructions: 618817776 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_vec8: total: - instructions: 589270684 + instructions: 602624309 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: - instructions: 752324238 + instructions: 761632935 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: - instructions: 5024878622 + instructions: 4553964491 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: - instructions: 1454289615 + instructions: 1456648411 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: - instructions: 909857926 + instructions: 923173767 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: - instructions: 2317194166 + instructions: 2286348225 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: - instructions: 1676138434 + instructions: 1725908127 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: - instructions: 1012919630 + instructions: 1062607331 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: - instructions: 836775350 + instructions: 885192472 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: - instructions: 1231388606 + instructions: 1273590765 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: - instructions: 843288710 + instructions: 892627036 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: - instructions: 841791715 + instructions: 891606025 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: - instructions: 1395152647 + instructions: 1438443895 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: - instructions: 925864211 + instructions: 972956178 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: - instructions: 835455678 + instructions: 885742038 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: - instructions: 650876759 + instructions: 665339043 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: - instructions: 3268904351 + instructions: 3123529322 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: - instructions: 1180916062 + instructions: 1183067683 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: - instructions: 821907983 + instructions: 832533102 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_0b: total: - instructions: 1462853 + instructions: 1539245 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_10kib: total: - instructions: 57039052 + instructions: 57053247 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_20_10mib: total: - instructions: 1103718913 + instructions: 1103719335 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_0b: total: - instructions: 1464279 + instructions: 1540240 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_10kib: total: - instructions: 57015976 + instructions: 57034266 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_20_10mib: total: - instructions: 1103718490 + instructions: 1103718900 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_0b: total: - instructions: 935633 + instructions: 1179993 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_10kib: total: - instructions: 2348959 + instructions: 2586980 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_20_10mib: total: - instructions: 18465091 + instructions: 18469909 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_0b: total: - instructions: 936583 + instructions: 1179908 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_10kib: total: - instructions: 2328902 + instructions: 2568035 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_20_10mib: total: - instructions: 18465101 + instructions: 18469895 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_0b: total: - instructions: 1457191 + instructions: 1515583 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_10kib: total: - instructions: 57033390 + instructions: 57029585 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_20_10mib: total: - instructions: 1103718803 + instructions: 1103718865 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_0b: total: - instructions: 1459281 + instructions: 1517242 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_10kib: total: - instructions: 57010978 + instructions: 57011268 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_20_10mib: total: - instructions: 1103718392 + instructions: 1103718442 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/src/btreemap.rs b/src/btreemap.rs index ccc1f62f..b0a86620 100644 --- a/src/btreemap.rs +++ b/src/btreemap.rs @@ -505,7 +505,7 @@ where let mut root = self.load_node(self.root_addr); // Check if the key already exists in the root. - if let Ok(idx) = root.search(&key) { + if let Ok(idx) = root.search(&key, self.memory()) { // The key exists. Overwrite it and return the previous value. let (_, previous_value) = root.swap_entry(idx, (key, value), self.memory()); self.save_node(&mut root); @@ -548,7 +548,7 @@ where assert!(!node.is_full()); // Look for the key in the node. - match node.search(&key) { + match node.search(&key, self.memory()) { Ok(idx) => { // The key is already in the node. // Overwrite it and return the previous value. @@ -581,7 +581,7 @@ where if child.is_full() { // Check if the key already exists in the child. - if let Ok(idx) = child.search(&key) { + if let Ok(idx) = child.search(&key, self.memory()) { // The key exists. Overwrite it and return the previous value. let (_, previous_value) = child.swap_entry(idx, (key, value), self.memory()); @@ -594,7 +594,7 @@ where // The children have now changed. Search again for // the child where we need to store the entry in. - let idx = node.search(&key).unwrap_or_else(|idx| idx); + let idx = node.search(&key, self.memory()).unwrap_or_else(|idx| idx); child = self.load_node(node.child(idx)); } @@ -674,7 +674,7 @@ where { let node = self.load_node(node_addr); // Look for the key in the current node. - match node.search(key) { + match node.search(key, self.memory()) { Ok(idx) => Some(f(node, idx)), // Key found: apply `f`. Err(idx) => match node.node_type() { NodeType::Leaf => None, // At a leaf: key not present. @@ -791,7 +791,7 @@ where match node.node_type() { NodeType::Leaf => { - match node.search(key) { + match node.search(key, self.memory()) { Ok(idx) => { // Case 1: The node is a leaf node and the key exists in it. // This is the simplest case. The key is removed from the leaf. @@ -818,7 +818,7 @@ where } } NodeType::Internal => { - match node.search(key) { + match node.search(key, self.memory()) { Ok(idx) => { // Case 2: The node is an internal node and the key exists in it. @@ -1622,7 +1622,7 @@ mod test { assert!(right_child.is_full()); let median_index = right_child.entries_len() / 2; let median_key = key(12); - assert_eq!(right_child.key(median_index), &median_key); + assert_eq!(right_child.key(median_index, btree.memory()), &median_key); // Overwrite the value of the median key. assert_eq!(btree.insert(median_key.clone(), value(123)), Some(value(0))); @@ -3271,7 +3271,7 @@ mod test { // [0, 1, 2, 3, 4, 5] [7, 8, 9, 10, 11] let root = btree.load_node(btree.root_addr); assert_eq!(root.node_type(), NodeType::Internal); - assert_eq!(root.keys(), vec![&[6; 10_000]]); + assert_eq!(root.keys(btree.memory()), vec![&[6; 10_000]]); assert_eq!(root.children_len(), 2); // Remove the element in the root. @@ -3283,7 +3283,7 @@ mod test { // [0, 1, 2, 3, 4] [7, 8, 9, 10, 11] let root = btree.load_node(btree.root_addr); assert_eq!(root.node_type(), NodeType::Internal); - assert_eq!(root.keys(), vec![&[5; 10_000]]); + assert_eq!(root.keys(btree.memory()), vec![&[5; 10_000]]); assert_eq!(root.children_len(), 2); // Remove the element in the root. This triggers the case where the root @@ -3295,7 +3295,7 @@ mod test { let root = btree.load_node(btree.root_addr); assert_eq!(root.node_type(), NodeType::Leaf); assert_eq!( - root.keys(), + root.keys(btree.memory()), vec![ &[0; 10_000], &[1; 10_000], diff --git a/src/btreemap/iter.rs b/src/btreemap/iter.rs index 82869508..1e653e16 100644 --- a/src/btreemap/iter.rs +++ b/src/btreemap/iter.rs @@ -94,7 +94,7 @@ where Bound::Included(key) | Bound::Excluded(key) => { let mut node = self.map.load_node(self.map.root_addr); loop { - match node.search(key) { + match node.search(key, self.map.memory()) { Ok(idx) => { if let Bound::Included(_) = self.range.start_bound() { // We found the key exactly matching the left bound. @@ -115,7 +115,7 @@ where }; if idx + 1 < node.entries_len() - && self.range.contains(node.key(idx + 1)) + && self.range.contains(node.key(idx + 1, self.map.memory())) { self.forward_cursors.push(Cursor::Node { node, @@ -152,7 +152,9 @@ where NodeType::Leaf => None, }; - if idx < node.entries_len() && self.range.contains(node.key(idx)) { + if idx < node.entries_len() + && self.range.contains(node.key(idx, self.map.memory())) + { self.forward_cursors.push(Cursor::Node { node, next: Index::Entry(idx), @@ -188,7 +190,7 @@ where Bound::Included(key) | Bound::Excluded(key) => { let mut node = self.map.load_node(self.map.root_addr); loop { - match node.search(key) { + match node.search(key, self.map.memory()) { Ok(idx) => { if let Bound::Included(_) = self.range.end_bound() { // We found the key exactly matching the right bound. @@ -208,7 +210,9 @@ where NodeType::Leaf => None, }; - if idx > 0 && self.range.contains(node.key(idx - 1)) { + if idx > 0 + && self.range.contains(node.key(idx - 1, self.map.memory())) + { self.backward_cursors.push(Cursor::Node { node, next: Index::Entry(idx - 1), @@ -243,7 +247,8 @@ where NodeType::Leaf => None, }; - if idx > 0 && self.range.contains(node.key(idx - 1)) { + if idx > 0 && self.range.contains(node.key(idx - 1, self.map.memory())) + { self.backward_cursors.push(Cursor::Node { node, next: Index::Entry(idx - 1), @@ -320,7 +325,7 @@ where next: Index::Entry(entry_idx), } => { // If the key does not belong to the range, iteration stops. - if !self.range.contains(node.key(entry_idx)) { + if !self.range.contains(node.key(entry_idx, self.map.memory())) { // Clear all cursors to avoid needless work in subsequent calls. self.forward_cursors = vec![]; self.backward_cursors = vec![]; @@ -328,7 +333,7 @@ where } let res = map(&node, entry_idx); - self.range.0 = Bound::Excluded(node.key(entry_idx).clone()); + self.range.0 = Bound::Excluded(node.key(entry_idx, self.map.memory()).clone()); let next = match node.node_type() { // If this is an internal node, add the next child to the cursors. @@ -403,7 +408,7 @@ where next: Index::Entry(entry_idx), } => { // If the key does not belong to the range, iteration stops. - if !self.range.contains(node.key(entry_idx)) { + if !self.range.contains(node.key(entry_idx, self.map.memory())) { // Clear all cursors to avoid needless work in subsequent calls. self.forward_cursors = vec![]; self.backward_cursors = vec![]; @@ -411,7 +416,7 @@ where } let res = map(&node, entry_idx); - self.range.1 = Bound::Excluded(node.key(entry_idx).clone()); + self.range.1 = Bound::Excluded(node.key(entry_idx, self.map.memory()).clone()); if let Some(next) = match node.node_type() { // If this is an internal node, add the previous child to the cursors. @@ -497,7 +502,7 @@ where fn next(&mut self) -> Option { self.0 - .next_map(|node, entry_idx| node.key(entry_idx).clone()) + .next_map(|node, entry_idx| node.key(entry_idx, self.0.map.memory()).clone()) } fn count(mut self) -> usize @@ -516,7 +521,7 @@ where { fn next_back(&mut self) -> Option { self.0 - .next_back_map(|node, entry_idx| node.key(entry_idx).clone()) + .next_back_map(|node, entry_idx| node.key(entry_idx, self.0.map.memory()).clone()) } } diff --git a/src/btreemap/node.rs b/src/btreemap/node.rs index 270cc46f..d4096918 100644 --- a/src/btreemap/node.rs +++ b/src/btreemap/node.rs @@ -39,7 +39,7 @@ pub enum NodeType { pub type Entry = (K, Vec); pub type EntryRef<'a, K> = (&'a K, &'a [u8]); -type LazyEntry = (K, LazyValue); +type LazyEntry = (LazyKey, LazyValue); /// A node of a B-Tree. /// @@ -113,7 +113,7 @@ impl Node { .last() .expect("A node can never be empty"); ( - self.get_key(last_entry).clone(), + self.get_key(last_entry, memory).clone(), self.get_value(last_entry, memory).to_vec(), ) } @@ -165,21 +165,23 @@ impl Node { ) -> Entry { let (old_key, old_value) = core::mem::replace( &mut self.keys_and_encoded_values[idx], - (key, LazyValue::by_value(value)), + (LazyKey::by_value(key), LazyValue::by_value(value)), ); - (old_key, self.extract_value(old_value, memory)) + ( + self.extract_key(old_key, memory), + self.extract_value(old_value, memory), + ) } /// Returns a reference to the entry at the specified index. #[inline(always)] pub fn entry(&self, idx: usize, memory: &M) -> EntryRef { - (self.key(idx), self.value(idx, memory)) + (self.key(idx, memory), self.value(idx, memory)) } #[inline(always)] - fn get_key<'a>(&'a self, (k, _): &'a LazyEntry) -> &'a K { - // TODO: implement lazy loading for keys. - k + fn get_key<'a, M: Memory>(&'a self, (k, _): &'a LazyEntry, memory: &M) -> &'a K { + k.get_or_load(|offset| self.load_key_from_memory(offset, memory)) } /// Returns a reference to the cached value and loads it from memory if needed. @@ -190,8 +192,8 @@ impl Node { /// Returns a reference to the key at the specified index. #[inline(always)] - pub fn key(&self, idx: usize) -> &K { - self.get_key(&self.keys_and_encoded_values[idx]) + pub fn key(&self, idx: usize, memory: &M) -> &K { + self.get_key(&self.keys_and_encoded_values[idx], memory) } /// Returns a reference to the encoded value at the specified index. @@ -200,14 +202,51 @@ impl Node { self.get_value(&self.keys_and_encoded_values[idx], memory) } - // TODO: add extract_key() here. + /// Extracts the contents of key (by loading it first if it's not loaded yet). + fn extract_key(&self, key: LazyKey, memory: &M) -> K { + key.take_or_load(|offset| self.load_key_from_memory(offset, memory)) + } /// Extracts the contents of value (by loading it first if it's not loaded yet). fn extract_value(&self, value: LazyValue, memory: &M) -> Vec { value.take_or_load(|offset| self.load_value_from_memory(offset, memory)) } - /// Loads a value from stable memory at the given offset of this node. + /// Loads a key from stable memory at the given offset. + fn load_key_from_memory(&self, mut offset: Bytes, memory: &M) -> K { + let reader = NodeReader { + address: self.address, + overflows: &self.overflows, + page_size: self.page_size(), + memory, + }; + + let size = match self.version { + Version::V1(_) => { + // V1: key size is always stored in memory. + let size = read_u32(&reader, Address::from(offset.get())); + offset += U32_SIZE; + size + } + Version::V2(_) => { + // V2: use fixed size if available, otherwise read from memory. + if K::BOUND.is_fixed_size() { + K::BOUND.max_size() + } else { + let size = read_u32(&reader, Address::from(offset.get())); + offset += U32_SIZE; + size + } + } + } as usize; + + let mut bytes = Vec::with_capacity(size); + read_to_vec(&reader, Address::from(offset.get()), &mut bytes, size); + + K::from_bytes(Cow::Borrowed(&bytes)) + } + + /// Loads a value from stable memory at the given offset. fn load_value_from_memory(&self, offset: Bytes, memory: &M) -> Vec { let reader = NodeReader { address: self.address, @@ -216,13 +255,13 @@ impl Node { memory, }; - let value_size = read_u32(&reader, Address::from(offset.get())) as usize; - let mut bytes = vec![]; + let size = read_u32(&reader, Address::from(offset.get())) as usize; + let mut bytes = Vec::with_capacity(size); read_to_vec( &reader, Address::from((offset + U32_SIZE).get()), &mut bytes, - value_size, + size, ); bytes @@ -265,26 +304,32 @@ impl Node { /// Inserts a new entry at the specified index. pub fn insert_entry(&mut self, idx: usize, (key, value): Entry) { self.keys_and_encoded_values - .insert(idx, (key, LazyValue::by_value(value))); + .insert(idx, (LazyKey::by_value(key), LazyValue::by_value(value))); } /// Returns the entry at the specified index while consuming this node. pub fn into_entry(mut self, idx: usize, memory: &M) -> Entry { let keys_and_encoded_values = core::mem::take(&mut self.keys_and_encoded_values); let (key, value) = keys_and_encoded_values.into_iter().nth(idx).unwrap(); - (key, self.extract_value(value, memory)) + ( + self.extract_key(key, memory), + self.extract_value(value, memory), + ) } /// Removes the entry at the specified index. pub fn remove_entry(&mut self, idx: usize, memory: &M) -> Entry { let (key, value) = self.keys_and_encoded_values.remove(idx); - (key, self.extract_value(value, memory)) + ( + self.extract_key(key, memory), + self.extract_value(value, memory), + ) } /// Adds a new entry at the back of the node. pub fn push_entry(&mut self, (key, value): Entry) { self.keys_and_encoded_values - .push((key, LazyValue::by_value(value))); + .push((LazyKey::by_value(key), LazyValue::by_value(value))); } /// Removes an entry from the back of the node. @@ -299,7 +344,10 @@ impl Node { .pop() .expect("node must not be empty"); - Some((key, self.extract_value(value, memory))) + Some(( + self.extract_key(key, memory), + self.extract_value(value, memory), + )) } /// Merges the entries and children of the `source` node into self, along with the median entry. @@ -319,19 +367,19 @@ impl Node { median: Entry, allocator: &mut Allocator, ) { - // Load all the values from the source node first, as they will be moved out. + // Load all the entries from the source node first, as they will be moved out. for i in 0..source.entries_len() { - source.value(i, allocator.memory()); + source.entry(i, allocator.memory()); } - if source.key(0) > self.key(0) { + if source.key(0, allocator.memory()) > self.key(0, allocator.memory()) { // The source node has keys that are greater than self. // Append the source node into self. - Self::append(self, &mut source, median); + Self::append(self, &mut source, median, allocator.memory()); } else { // self has keys that are greater than the source node. // Append self into the source node (which more efficient). - Self::append(&mut source, self, median); + Self::append(&mut source, self, median, allocator.memory()); // Move the entries and children into self. self.keys_and_encoded_values = core::mem::take(&mut source.keys_and_encoded_values); @@ -352,14 +400,14 @@ impl Node { /// /// POSTCONDITION: /// * `b` is empty. - fn append(a: &mut Node, b: &mut Node, median: Entry) { + fn append(a: &mut Node, b: &mut Node, median: Entry, memory: &M) { // Assert preconditions. let a_len = a.entries_len(); assert_eq!(a.node_type(), b.node_type()); assert!(b.entries_len() > 0); assert!(a_len > 0); - assert!(a.key(a_len - 1) < &median.0); - assert!(&median.0 < b.key(0)); + assert!(a.key(a_len - 1, memory) < &median.0); + assert!(&median.0 < b.key(0, memory)); a.push_entry(median); @@ -377,14 +425,14 @@ impl Node { #[cfg(test)] pub fn entries(&self, memory: &M) -> Vec> { (0..self.keys_and_encoded_values.len()) - .map(|i| (self.key(i).clone(), self.value(i, memory).to_vec())) + .map(|i| (self.key(i, memory).clone(), self.value(i, memory).to_vec())) .collect() } #[cfg(test)] - pub fn keys(&self) -> Vec<&K> { + pub fn keys(&self, memory: &M) -> Vec<&K> { (0..self.keys_and_encoded_values.len()) - .map(|i| self.key(i)) + .map(|i| self.key(i, memory)) .collect() } @@ -404,9 +452,9 @@ impl Node { /// of the matching key. If the value is not found then `Result::Err` is /// returned, containing the index where a matching key could be inserted /// while maintaining sorted order. - pub fn search(&self, key: &K) -> Result { + pub fn search(&self, key: &K, memory: &M) -> Result { self.keys_and_encoded_values - .binary_search_by_key(&key, |entry| self.get_key(entry)) + .binary_search_by_key(&key, |entry| self.get_key(entry, memory)) } /// Returns the maximum size a node can be if it has bounded keys and values. @@ -431,9 +479,9 @@ impl Node { pub fn split(&mut self, sibling: &mut Node, memory: &M) -> Entry { debug_assert!(self.is_full()); - // Load the values that will be moved out of the node and into the new sibling. + // Load the entries that will be moved out of the node and into the new sibling. for idx in B..self.entries_len() { - self.value(idx, memory); + self.entry(idx, memory); } // Move the entries and children above the median into the new sibling. @@ -539,6 +587,31 @@ impl LazyValue { } } +#[derive(Debug)] +struct LazyKey(LazyObject); + +impl LazyKey { + #[inline(always)] + pub fn by_value(value: K) -> Self { + Self(LazyObject::by_value(value)) + } + + #[inline(always)] + pub fn by_ref(offset: Bytes) -> Self { + Self(LazyObject::by_ref(offset)) + } + + #[inline(always)] + pub fn get_or_load(&self, load: impl FnOnce(Bytes) -> K) -> &K { + self.0.get_or_load(load) + } + + #[inline(always)] + pub fn take_or_load(self, load: impl FnOnce(Bytes) -> K) -> K { + self.0.take_or_load(load) + } +} + /// Stores version-specific data. #[derive(Debug, PartialEq, Copy, Clone, Eq)] pub enum Version { diff --git a/src/btreemap/node/v1.rs b/src/btreemap/node/v1.rs index 5e0a64cd..63e13327 100644 --- a/src/btreemap/node/v1.rs +++ b/src/btreemap/node/v1.rs @@ -69,20 +69,18 @@ impl Node { // Load the entries. let mut keys_encoded_values = Vec::with_capacity(header.num_entries as usize); let mut offset = NodeHeader::size(); - let mut buf = vec![]; for _ in 0..header.num_entries { - // Read the key's size. - let key_size = read_u32(memory, address + offset); + let key_offset = offset; offset += U32_SIZE; - - // Read the key. - read_to_vec(memory, address + offset, &mut buf, key_size as usize); + let key = LazyKey::by_ref(key_offset); offset += Bytes::from(max_key_size); - let key = K::from_bytes(Cow::Borrowed(&buf)); - // Values are loaded lazily. Store a reference and skip loading it. - keys_encoded_values.push((key, LazyValue::by_ref(offset))); - offset += U32_SIZE + Bytes::from(max_value_size); + let value_offset = offset; + offset += U32_SIZE; + let value = LazyValue::by_ref(value_offset); + offset += Bytes::from(max_value_size); + + keys_encoded_values.push((key, value)); } // Load children if this is an internal node. @@ -136,7 +134,7 @@ impl Node { assert!(self .keys_and_encoded_values .windows(2) - .all(|arr| self.get_key(&arr[0]) < self.get_key(&arr[1]))); + .all(|arr| self.get_key(&arr[0], memory) < self.get_key(&arr[1], memory))); let (max_key_size, max_value_size) = match self.version { Version::V1(DerivedPageSize { @@ -160,16 +158,16 @@ impl Node { let mut offset = NodeHeader::size(); - // Load all the values. This is necessary so that we don't overwrite referenced - // values when writing the entries to the node. + // Load all the entries. This is necessary so that we don't overwrite referenced + // entries when writing the entries to the node. for i in 0..self.keys_and_encoded_values.len() { - self.value(i, memory); + self.entry(i, memory); } // Write the entries. for i in 0..self.keys_and_encoded_values.len() { // Write the size of the key. - let key_bytes = self.key(i).to_bytes_checked(); + let key_bytes = self.key(i, memory).to_bytes_checked(); write_u32(memory, self.address + offset, key_bytes.len() as u32); offset += U32_SIZE; diff --git a/src/btreemap/node/v2.rs b/src/btreemap/node/v2.rs index 5f792c1f..dab0bba2 100644 --- a/src/btreemap/node/v2.rs +++ b/src/btreemap/node/v2.rs @@ -149,26 +149,38 @@ impl Node { } } - // Load the keys. + // Load the keys (eagerly if small). + const EAGER_LOAD_KEY_SIZE_THRESHOLD: u32 = 16; let mut keys_encoded_values = Vec::with_capacity(num_entries); let mut buf = vec![]; + for _ in 0..num_entries { - // Load the key's size. + let key_offset = Bytes::from(offset.get()); + + // Get key size. let key_size = if K::BOUND.is_fixed_size() { - // Key is fixed in size. The size of the key is always its max size. K::BOUND.max_size() } else { - // Key is not fixed in size. Read the size from memory. - let value = read_u32(&reader, offset); + let size = read_u32(&reader, offset); offset += U32_SIZE; - value + size + }; + + // Eager-load small keys, defer large ones. + let key = if key_size <= EAGER_LOAD_KEY_SIZE_THRESHOLD { + read_to_vec( + &reader, + Address::from(offset.get()), + &mut buf, + key_size as usize, + ); + LazyKey::by_value(K::from_bytes(Cow::Borrowed(&buf))) + } else { + LazyKey::by_ref(key_offset) }; - // Load the key. - read_to_vec(&reader, offset, &mut buf, key_size as usize); - let key = K::from_bytes(Cow::Borrowed(&buf)); offset += Bytes::from(key_size); - keys_encoded_values.push((key, LazyValue::by_ref(Bytes::from(0usize)))); + keys_encoded_values.push((key, LazyValue::by_ref(Bytes::from(0_u64)))); } // Load the values @@ -240,7 +252,7 @@ impl Node { // Write the keys. for i in 0..self.keys_and_encoded_values.len() { - let key = self.key(i); + let key = self.key(i, writer.memory()); let key_bytes = key.to_bytes_checked(); // Write the size of the key if it isn't fixed in size.