diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index 4d164584..2dabed3e 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -604,301 +604,301 @@ benches: btreemap_v2_insert_10mib_values: total: calls: 1 - instructions: 4387226354 + instructions: 4388592719 heap_increase: 161 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 436629416 + instructions: 436633391 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: calls: 1 - instructions: 5496218165 + instructions: 5496222167 heap_increase: 0 stable_memory_increase: 196 scopes: {} btreemap_v2_insert_blob_128_128: total: calls: 1 - instructions: 1180834208 + instructions: 1180838234 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: calls: 1 - instructions: 486246194 + instructions: 486249812 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: calls: 1 - instructions: 1789034049 + instructions: 1789038066 heap_increase: 0 stable_memory_increase: 67 scopes: {} btreemap_v2_insert_blob_32_0: total: calls: 1 - instructions: 490455134 + instructions: 490459106 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_1024: total: calls: 1 - instructions: 703496225 + instructions: 703500065 heap_increase: 0 stable_memory_increase: 173 scopes: {} btreemap_v2_insert_blob_32_128: total: calls: 1 - instructions: 542564351 + instructions: 542568143 heap_increase: 0 stable_memory_increase: 28 scopes: {} btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 519113244 + instructions: 519117156 heap_increase: 0 stable_memory_increase: 11 scopes: {} btreemap_v2_insert_blob_32_256: total: calls: 1 - instructions: 570686267 + instructions: 570690137 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: calls: 1 - instructions: 528947313 + instructions: 528951192 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 509376109 + instructions: 509380036 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: calls: 1 - instructions: 610059178 + instructions: 610063051 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: calls: 1 - instructions: 534917409 + instructions: 534921249 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: calls: 1 - instructions: 517590057 + instructions: 517593840 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: calls: 1 - instructions: 407266843 + instructions: 407268940 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_512_128: total: calls: 1 - instructions: 3041219347 + instructions: 3041223382 heap_increase: 0 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: calls: 1 - instructions: 661175552 + instructions: 661179485 heap_increase: 0 stable_memory_increase: 34 scopes: {} btreemap_v2_insert_blob_8_128: total: calls: 1 - instructions: 458612442 + instructions: 458615568 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_principal: total: calls: 1 - instructions: 503303086 + instructions: 503308324 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 406739905 + instructions: 406744693 heap_increase: 0 stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: calls: 1 - instructions: 414575469 + instructions: 414580548 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 410368222 + instructions: 410372254 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 594100537 + instructions: 594103663 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2744513878 + instructions: 2744606200 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1012625574 + instructions: 1012643373 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 708984362 + instructions: 708997439 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1402182234 + instructions: 1402219761 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_0: total: calls: 1 - instructions: 621845953 + instructions: 621849784 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1182054323 + instructions: 1182132701 heap_increase: 0 stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 756092289 + instructions: 756106158 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 666188006 + instructions: 666191903 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 869200138 + instructions: 869225881 heap_increase: 0 stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 661641515 + instructions: 661645394 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 660350181 + instructions: 660354036 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 973623252 + instructions: 973664463 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 691630844 + instructions: 691643081 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 659842170 + instructions: 659845953 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 604348722 + instructions: 604355928 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1859108239 + instructions: 1859161681 heap_increase: 0 stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 846297779 + instructions: 846320282 heap_increase: 0 stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 666278550 + instructions: 666289233 heap_increase: 0 stable_memory_increase: 23 scopes: {} @@ -975,1148 +975,1148 @@ benches: btreemap_v2_mem_manager_insert_blob512_u64: total: calls: 1 - instructions: 3127693876 + instructions: 3127680452 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_blob512: total: calls: 1 - instructions: 607302030 + instructions: 607288370 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_u64: total: calls: 1 - instructions: 520562305 + instructions: 520545864 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_vec512: total: calls: 1 - instructions: 834230066 + instructions: 834100595 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: calls: 1 - instructions: 1964533302 + instructions: 1964405448 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_blob512_u64: total: calls: 1 - instructions: 4310230683 + instructions: 4310221225 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_blob512: total: calls: 1 - instructions: 882979670 + instructions: 882970074 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_u64: total: calls: 1 - instructions: 736797990 + instructions: 736785650 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_vec512: total: calls: 1 - instructions: 1223992077 + instructions: 1223804753 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_vec512_u64: total: calls: 1 - instructions: 3084753399 + instructions: 3084565257 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob8_u64: total: calls: 1 - instructions: 599252070 + instructions: 599256189 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_1024_128: total: calls: 1 - instructions: 8387598840 + instructions: 8387602842 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_128_128: total: calls: 1 - instructions: 1824721939 + instructions: 1824725965 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_16_128: total: calls: 1 - instructions: 743080488 + instructions: 743084112 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: calls: 1 - instructions: 2763907811 + instructions: 2763911828 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_0: total: calls: 1 - instructions: 751493486 + instructions: 751497584 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: calls: 1 - instructions: 1121477481 + instructions: 1121481321 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: calls: 1 - instructions: 860281370 + instructions: 860285162 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_16: total: calls: 1 - instructions: 795091803 + instructions: 795095715 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_256: total: calls: 1 - instructions: 891735934 + instructions: 891739804 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_32: total: calls: 1 - instructions: 808556626 + instructions: 808560505 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_4: total: calls: 1 - instructions: 778860667 + instructions: 778864648 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_512: total: calls: 1 - instructions: 957567308 + instructions: 957571175 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_64: total: calls: 1 - instructions: 817402668 + instructions: 817406508 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_8: total: calls: 1 - instructions: 796775177 + instructions: 796779002 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_4_128: total: calls: 1 - instructions: 371433628 + instructions: 371435725 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_512_128: total: calls: 1 - instructions: 4613696303 + instructions: 4613700344 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_64_128: total: calls: 1 - instructions: 1031691323 + instructions: 1031695256 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: calls: 1 - instructions: 604973040 + instructions: 604976184 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_principal: total: calls: 1 - instructions: 800186729 + instructions: 800191973 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_blob8: total: calls: 1 - instructions: 669272017 + instructions: 669276877 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: calls: 1 - instructions: 681259383 + instructions: 681264462 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_vec8: total: calls: 1 - instructions: 671825185 + instructions: 671829217 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec8_u64: total: calls: 1 - instructions: 782873009 + instructions: 782876135 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_1024_128: total: calls: 1 - instructions: 4049152840 + instructions: 4049265076 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_128_128: total: calls: 1 - instructions: 1503200945 + instructions: 1503218744 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_16_128: total: calls: 1 - instructions: 1024759071 + instructions: 1024772148 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_256_128: total: calls: 1 - instructions: 2019833997 + instructions: 2019891066 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_0: total: calls: 1 - instructions: 862942768 + instructions: 862946599 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_1024: total: calls: 1 - instructions: 1689732148 + instructions: 1689829372 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 1088853861 + instructions: 1088869698 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_16: total: calls: 1 - instructions: 928266909 + instructions: 928270806 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_256: total: calls: 1 - instructions: 1215441024 + instructions: 1215466767 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_32: total: calls: 1 - instructions: 931024329 + instructions: 931028208 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_4: total: calls: 1 - instructions: 914741844 + instructions: 914745699 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_512: total: calls: 1 - instructions: 1373208474 + instructions: 1373268399 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_64: total: calls: 1 - instructions: 972723364 + instructions: 972735601 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_8: total: calls: 1 - instructions: 924963880 + instructions: 924967663 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_4_128: total: calls: 1 - instructions: 540977502 + instructions: 540984708 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_512_128: total: calls: 1 - instructions: 2716276969 + instructions: 2716330411 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_64_128: total: calls: 1 - instructions: 1234517190 + instructions: 1234556907 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_8_128: total: calls: 1 - instructions: 850723549 + instructions: 850734232 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob8_u64: total: calls: 1 - instructions: 575657399 + instructions: 575661530 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_1024_128: total: calls: 1 - instructions: 8055243789 + instructions: 8055247791 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_128_128: total: calls: 1 - instructions: 1755505092 + instructions: 1755509118 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_16_128: total: calls: 1 - instructions: 716552465 + instructions: 716556083 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: calls: 1 - instructions: 2669726290 + instructions: 2669730307 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_0: total: calls: 1 - instructions: 723331257 + instructions: 723335313 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: calls: 1 - instructions: 1085446885 + instructions: 1085450731 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: calls: 1 - instructions: 825898514 + instructions: 825902306 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_16: total: calls: 1 - instructions: 766897485 + instructions: 766901397 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_256: total: calls: 1 - instructions: 860875781 + instructions: 860879651 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_32: total: calls: 1 - instructions: 775932537 + instructions: 775936416 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_4: total: calls: 1 - instructions: 755120630 + instructions: 755124599 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_512: total: calls: 1 - instructions: 932316858 + instructions: 932320719 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_64: total: calls: 1 - instructions: 791541850 + instructions: 791545690 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_8: total: calls: 1 - instructions: 768157909 + instructions: 768161716 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_4_128: total: calls: 1 - instructions: 357882924 + instructions: 357885021 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_512_128: total: calls: 1 - instructions: 4444563339 + instructions: 4444567386 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_64_128: total: calls: 1 - instructions: 999734778 + instructions: 999738711 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 598939732 + instructions: 598942864 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_principal: total: calls: 1 - instructions: 780286737 + instructions: 780291969 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_blob8: total: calls: 1 - instructions: 645807686 + instructions: 645812582 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: calls: 1 - instructions: 657450509 + instructions: 657455588 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_vec8: total: calls: 1 - instructions: 648264001 + instructions: 648268033 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec8_u64: total: calls: 1 - instructions: 759543968 + instructions: 759547094 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_1024_128: total: calls: 1 - instructions: 4254705881 + instructions: 4254818123 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_128_128: total: calls: 1 - instructions: 1509632411 + instructions: 1509650210 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_16_128: total: calls: 1 - instructions: 1006112737 + instructions: 1006125814 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_256_128: total: calls: 1 - instructions: 2073306796 + instructions: 2073363853 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_0: total: calls: 1 - instructions: 846105831 + instructions: 846109662 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_1024: total: calls: 1 - instructions: 1664340419 + instructions: 1664437667 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 1064595433 + instructions: 1064611264 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_16: total: calls: 1 - instructions: 902970558 + instructions: 902974455 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_256: total: calls: 1 - instructions: 1193426296 + instructions: 1193452039 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_32: total: calls: 1 - instructions: 910486468 + instructions: 910490347 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_4: total: calls: 1 - instructions: 898981741 + instructions: 898985596 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_512: total: calls: 1 - instructions: 1356854198 + instructions: 1356914135 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_64: total: calls: 1 - instructions: 949770518 + instructions: 949782755 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_8: total: calls: 1 - instructions: 902469709 + instructions: 902473492 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_4_128: total: calls: 1 - instructions: 527057733 + instructions: 527064939 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_512_128: total: calls: 1 - instructions: 2808111599 + instructions: 2808165041 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_64_128: total: calls: 1 - instructions: 1220784792 + instructions: 1220824533 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_8_128: total: calls: 1 - instructions: 850608896 + instructions: 850619579 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_0b: total: calls: 1 - instructions: 16905 + instructions: 16962 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_10kib: total: calls: 1 - instructions: 2475828 + instructions: 2507196 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_20_10mib: total: calls: 1 - instructions: 18469125 + instructions: 18468765 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_0b: total: calls: 1 - instructions: 17147 + instructions: 16933 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_10kib: total: calls: 1 - instructions: 56755378 + instructions: 2572994 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_20_10mib: total: calls: 1 - instructions: 1103713932 + instructions: 18469999 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_0b: total: calls: 1 - instructions: 17161 + instructions: 17300 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_10kib: total: calls: 1 - instructions: 56767374 + instructions: 20668618 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_20_10mib: total: calls: 1 - instructions: 1103714168 + instructions: 398305226 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_10mib_values: total: calls: 1 - instructions: 4709565702 + instructions: 4711118385 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 584632796 + instructions: 584636969 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: calls: 1 - instructions: 7363796307 + instructions: 7363800309 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: calls: 1 - instructions: 1588752303 + instructions: 1588756329 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: calls: 1 - instructions: 665334293 + instructions: 665337905 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: calls: 1 - instructions: 2421693283 + instructions: 2421697300 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_0: total: calls: 1 - instructions: 654246003 + instructions: 654250005 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: calls: 1 - instructions: 985322023 + instructions: 985325869 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: calls: 1 - instructions: 746605092 + instructions: 746608890 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: calls: 1 - instructions: 700056094 + instructions: 700059994 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 784121825 + instructions: 784125701 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: calls: 1 - instructions: 711915619 + instructions: 711919498 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 696210302 + instructions: 696214241 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: calls: 1 - instructions: 857932817 + instructions: 857936684 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: calls: 1 - instructions: 737070467 + instructions: 737074307 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 696054096 + instructions: 696057915 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: calls: 1 - instructions: 452855812 + instructions: 452857933 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: calls: 1 - instructions: 4071503214 + instructions: 4071507249 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: calls: 1 - instructions: 910048338 + instructions: 910052271 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: calls: 1 - instructions: 599296531 + instructions: 599299651 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_principal: total: calls: 1 - instructions: 684154256 + instructions: 684159422 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 566075041 + instructions: 566079913 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: calls: 1 - instructions: 586713652 + instructions: 586718731 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_vec8: total: calls: 1 - instructions: 571362323 + instructions: 571366355 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 755820792 + instructions: 755823918 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4475823940 + instructions: 4475943466 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1418195415 + instructions: 1418213214 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 921098213 + instructions: 921111290 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2244605357 + instructions: 2244668594 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_0: total: calls: 1 - instructions: 834326197 + instructions: 834330028 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1701459670 + instructions: 1701563272 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1036942087 + instructions: 1036968514 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 871324986 + instructions: 871328883 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1240150803 + instructions: 1240176546 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 867565590 + instructions: 867569469 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 862143565 + instructions: 862147420 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1405903551 + instructions: 1405971132 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 968300744 + instructions: 968312981 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 856473374 + instructions: 856477157 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 662114708 + instructions: 662121914 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 3082652829 + instructions: 3082706271 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1183921648 + instructions: 1183958569 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 821763732 + instructions: 821774415 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_0b: total: calls: 1 - instructions: 1230497 + instructions: 975992 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_10kib: total: calls: 1 - instructions: 56742812 + instructions: 2491763 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_20_10mib: total: calls: 1 - instructions: 1103712198 + instructions: 18467176 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_0b: total: calls: 1 - instructions: 1230076 + instructions: 978166 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_10kib: total: calls: 1 - instructions: 56713761 + instructions: 2475597 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_20_10mib: total: calls: 1 - instructions: 1103711703 + instructions: 18467168 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_0b: total: calls: 1 - instructions: 964793 + instructions: 982657 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_10kib: total: calls: 1 - instructions: 2477281 + instructions: 2498428 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_20_10mib: total: calls: 1 - instructions: 18468280 + instructions: 18467320 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_0b: total: calls: 1 - instructions: 964096 + instructions: 984223 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_10kib: total: calls: 1 - instructions: 2474637 + instructions: 2481654 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_20_10mib: total: calls: 1 - instructions: 18468224 + instructions: 18467298 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_0b: total: calls: 1 - instructions: 1207835 + instructions: 1230992 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_10kib: total: calls: 1 - instructions: 56720150 + instructions: 56740279 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_20_10mib: total: calls: 1 - instructions: 1103711748 + instructions: 1103710894 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_0b: total: calls: 1 - instructions: 1208078 + instructions: 1231498 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_10kib: total: calls: 1 - instructions: 56691763 + instructions: 56683107 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_20_10mib: total: calls: 1 - instructions: 1103711265 + instructions: 1103710405 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/btreemap/src/main.rs b/benchmarks/btreemap/src/main.rs index be0f648d..167b973c 100644 --- a/benchmarks/btreemap/src/main.rs +++ b/benchmarks/btreemap/src/main.rs @@ -777,7 +777,7 @@ fn range_key_sum_helper_v2(count: usize, size: usize) -> BenchResult { bench_fn(|| { btree .range((Bound::Included(0), Bound::Included(size as u32))) - .map(|(k, _)| k) + .map(|entry| *entry.key()) .sum::() }) } @@ -794,8 +794,8 @@ fn range_value_sum_helper_v2(count: usize, size: usize) -> BenchResult { bench_fn(|| { btree .range((Bound::Included(0), Bound::Included(size as u32))) - .filter(|(k, _)| k % 3 == 0) - .map(|(_, v)| v.len()) + .filter(|entry| *entry.key() % 3 == 0) + .map(|entry| entry.value().len()) .sum::() }) } diff --git a/benchmarks/btreeset/canbench_results.yml b/benchmarks/btreeset/canbench_results.yml index de9d69f8..8c79367a 100644 --- a/benchmarks/btreeset/canbench_results.yml +++ b/benchmarks/btreeset/canbench_results.yml @@ -72,420 +72,420 @@ benches: btreeset_intersection_blob_1024: total: calls: 1 - instructions: 108263601 + instructions: 101680337 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_128: total: calls: 1 - instructions: 17920913 + instructions: 16712295 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_16: total: calls: 1 - instructions: 3384240 + instructions: 3049602 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_256: total: calls: 1 - instructions: 30972687 + instructions: 28981189 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_32: total: calls: 1 - instructions: 4649143 + instructions: 4315571 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_512: total: calls: 1 - instructions: 56724310 + instructions: 53201464 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_64: total: calls: 1 - instructions: 10030807 + instructions: 9211343 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_8: total: calls: 1 - instructions: 3143262 + instructions: 2793050 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_u32: total: calls: 1 - instructions: 2255841 + instructions: 1921673 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_u64: total: calls: 1 - instructions: 2267883 + instructions: 1964949 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_1024: total: calls: 1 - instructions: 52366443 + instructions: 43769567 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_128: total: calls: 1 - instructions: 9323287 + instructions: 7897406 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_16: total: calls: 1 - instructions: 2175419 + instructions: 1907832 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_256: total: calls: 1 - instructions: 15614378 + instructions: 13164529 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_32: total: calls: 1 - instructions: 2838967 + instructions: 2539466 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_512: total: calls: 1 - instructions: 27865373 + instructions: 23366500 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_64: total: calls: 1 - instructions: 5294107 + instructions: 4381408 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_8: total: calls: 1 - instructions: 2092236 + instructions: 1850635 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_u32: total: calls: 1 - instructions: 1538826 + instructions: 1316543 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_u64: total: calls: 1 - instructions: 1556273 + instructions: 1343356 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_1024: total: calls: 1 - instructions: 384217 + instructions: 358419 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_128: total: calls: 1 - instructions: 89356 + instructions: 85062 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_16: total: calls: 1 - instructions: 53971 + instructions: 53155 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_256: total: calls: 1 - instructions: 131545 + instructions: 124179 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_32: total: calls: 1 - instructions: 45717 + instructions: 44795 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_512: total: calls: 1 - instructions: 215769 + instructions: 202259 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_64: total: calls: 1 - instructions: 57967 + instructions: 55209 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_8: total: calls: 1 - instructions: 52516 + instructions: 51777 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_u32: total: calls: 1 - instructions: 43314 + instructions: 42450 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_u64: total: calls: 1 - instructions: 43860 + instructions: 43256 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_1024: total: calls: 1 - instructions: 91649624 + instructions: 78740555 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_128: total: calls: 1 - instructions: 15493688 + instructions: 13352888 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_16: total: calls: 1 - instructions: 3305021 + instructions: 2920490 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_256: total: calls: 1 - instructions: 26708656 + instructions: 23003003 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_32: total: calls: 1 - instructions: 4519479 + instructions: 4069766 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_512: total: calls: 1 - instructions: 48351640 + instructions: 41561193 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_64: total: calls: 1 - instructions: 8632441 + instructions: 7266779 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_8: total: calls: 1 - instructions: 3083597 + instructions: 2727094 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_u32: total: calls: 1 - instructions: 2253391 + instructions: 1921351 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_u64: total: calls: 1 - instructions: 2268826 + instructions: 1961281 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_1024: total: calls: 1 - instructions: 433183747 + instructions: 430995530 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_128: total: calls: 1 - instructions: 75703425 + instructions: 74503150 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_16: total: calls: 1 - instructions: 15831272 + instructions: 14579696 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_256: total: calls: 1 - instructions: 127937637 + instructions: 125787984 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_32: total: calls: 1 - instructions: 22129524 + instructions: 20939791 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_512: total: calls: 1 - instructions: 229664008 + instructions: 227475530 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_64: total: calls: 1 - instructions: 40653995 + instructions: 39453577 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_8: total: calls: 1 - instructions: 15219849 + instructions: 14004824 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_u32: total: calls: 1 - instructions: 11969602 + instructions: 10667867 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_u64: total: calls: 1 - instructions: 12055874 + instructions: 10908079 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_1024: total: calls: 1 - instructions: 260401564 + instructions: 259870196 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_128: total: calls: 1 - instructions: 46191169 + instructions: 45508439 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_16: total: calls: 1 - instructions: 10196231 + instructions: 9508605 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_256: total: calls: 1 - instructions: 77000621 + instructions: 76456411 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_32: total: calls: 1 - instructions: 13966929 + instructions: 13294157 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_512: total: calls: 1 - instructions: 138120554 + instructions: 137589173 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_64: total: calls: 1 - instructions: 25112906 + instructions: 24443488 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_8: total: calls: 1 - instructions: 9824865 + instructions: 9144616 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_u32: total: calls: 1 - instructions: 7220114 + instructions: 6480292 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_u64: total: calls: 1 - instructions: 7262243 + instructions: 6624379 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -562,140 +562,140 @@ benches: btreeset_symmetric_difference_blob_1024: total: calls: 1 - instructions: 108277727 + instructions: 101670997 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_128: total: calls: 1 - instructions: 17924287 + instructions: 16692203 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_16: total: calls: 1 - instructions: 3385864 + instructions: 3027274 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_256: total: calls: 1 - instructions: 30977597 + instructions: 28962633 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_32: total: calls: 1 - instructions: 4650811 + instructions: 4281313 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_512: total: calls: 1 - instructions: 56732292 + instructions: 53185980 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_64: total: calls: 1 - instructions: 10033413 + instructions: 9190483 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_8: total: calls: 1 - instructions: 3144865 + instructions: 2776181 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_u32: total: calls: 1 - instructions: 2271949 + instructions: 1901309 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_u64: total: calls: 1 - instructions: 2273968 + instructions: 1935566 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_1024: total: calls: 1 - instructions: 108278235 + instructions: 101691006 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_128: total: calls: 1 - instructions: 17924795 + instructions: 16712212 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_16: total: calls: 1 - instructions: 3386372 + instructions: 3047765 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_256: total: calls: 1 - instructions: 30978105 + instructions: 28982642 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_32: total: calls: 1 - instructions: 4651319 + instructions: 4313788 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_512: total: calls: 1 - instructions: 56732800 + instructions: 53205989 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_64: total: calls: 1 - instructions: 10033921 + instructions: 9210492 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_8: total: calls: 1 - instructions: 3145373 + instructions: 2791177 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_u32: total: calls: 1 - instructions: 2269456 + instructions: 1900823 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_u64: total: calls: 1 - instructions: 2269478 + instructions: 1969072 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/nns/canbench_results.yml b/benchmarks/nns/canbench_results.yml index 91fda075..4186b23d 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: 1375361602 + instructions: 1375501036 heap_increase: 10 stable_memory_increase: 0 scopes: {} vote_cascading_stable_centralized_1k: total: calls: 1 - instructions: 99869278 + instructions: 99996435 heap_increase: 1 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_10k_15: total: calls: 1 - instructions: 9800292700 + instructions: 9819218496 heap_increase: 5 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_10k_5: total: calls: 1 - instructions: 3004791001 + instructions: 3007431336 heap_increase: 5 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_1k_15: total: calls: 1 - instructions: 865575963 + instructions: 867330736 heap_increase: 0 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_1k_5: total: calls: 1 - instructions: 252822713 + instructions: 253041123 heap_increase: 0 stable_memory_increase: 0 scopes: {} vote_cascading_stable_single_vote_10k: total: calls: 1 - instructions: 91204 + instructions: 91466 heap_increase: 0 stable_memory_increase: 0 scopes: {} vote_cascading_stable_single_vote_1k: total: calls: 1 - instructions: 66626 + instructions: 66840 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/nns/src/nns_vote_cascading.rs b/benchmarks/nns/src/nns_vote_cascading.rs index 6dadf5b5..d3545820 100644 --- a/benchmarks/nns/src/nns_vote_cascading.rs +++ b/benchmarks/nns/src/nns_vote_cascading.rs @@ -69,12 +69,12 @@ impl NeuronStore for StableNeuronStore { let previous_followees = self .followees_map .range(min_followee_map_key..=max_followee_map_key) - .map(|(_key, value)| value) + .map(|entry| entry.value()) .collect::>(); let previous_followee_keys = self .followees_map .range(min_followee_map_key..=max_followee_map_key) - .map(|(key, _value)| key) + .map(|entry| *entry.key()) .collect::>(); for key in previous_followee_keys { self.followees_map.remove(&key); @@ -104,7 +104,7 @@ impl NeuronStore for StableNeuronStore { self.followees_map .range(min_key..=max_key) - .map(|(_key, followee_neuron_id)| followee_neuron_id) + .map(|entry| entry.value()) .collect() } @@ -114,7 +114,10 @@ impl NeuronStore for StableNeuronStore { self.followers_index .range(min_key..=max_key) - .map(|(((_topic, _followee_neuron_id), follower_neuron_id), _value)| follower_neuron_id) + .map(|entry| { + let ((_topic, _followee_neuron_id), follower_neuron_id) = entry.key(); + *follower_neuron_id + }) .collect() } } diff --git a/src/btreemap.rs b/src/btreemap.rs index 022f1171..19ad8780 100644 --- a/src/btreemap.rs +++ b/src/btreemap.rs @@ -1157,8 +1157,8 @@ where /// map.insert(1, "one".to_string()); /// map.insert(2, "two".to_string()); /// - /// for (key, value) in map.iter() { - /// println!("{}: {}", key, value); + /// for entry in map.iter() { + /// println!("{}: {}", entry.key(), entry.value()); /// } /// ``` pub fn iter(&self) -> Iter<'_, K, V, M> { @@ -1180,8 +1180,8 @@ where /// map.insert(3, "three".to_string()); /// /// // Get entries with keys between 1 and 3 (inclusive) - /// for (key, value) in map.range((Bound::Included(1), Bound::Included(3))) { - /// println!("{}: {}", key, value); + /// for entry in map.range((Bound::Included(1), Bound::Included(3))) { + /// println!("{}: {}", entry.key(), entry.value()); /// } /// ``` pub fn range(&self, key_range: impl RangeBounds) -> Iter<'_, K, V, M> { @@ -1195,7 +1195,8 @@ where /// /// Returns an empty iterator if no smaller key exists. pub fn iter_from_prev_key(&self, bound: &K) -> Iter<'_, K, V, M> { - if let Some((start_key, _)) = self.range(..bound).next_back() { + if let Some(entry) = self.range(..bound).next_back() { + let start_key = entry.key().clone(); IterInternal::new_in_range(self, (Bound::Included(start_key), Bound::Unbounded)).into() } else { IterInternal::null(self).into() @@ -1350,6 +1351,7 @@ where mod test { use super::*; use crate::{ + btreemap::iter::LazyEntry, storable::{Blob, Bound as StorableBound}, VectorMemory, }; @@ -1369,6 +1371,16 @@ mod test { it.collect() } + /// A helper function to collect lazy entries into a `Vec`. + fn collect_entry<'a, K, V, M>(it: impl Iterator>) -> Vec<(K, V)> + where + K: Storable + Ord + Clone + 'a, + V: Storable + 'a, + M: Memory + 'a, + { + it.map(|entry| entry.into_pair()).collect() + } + /// Returns a fixed‑size buffer for the given u32. fn monotonic_buffer(i: u32) -> [u8; N] { let mut buf = [0u8; N]; @@ -2428,9 +2440,9 @@ mod test { let key = K::build; run_btree_test(|btree: BTreeMap| { // Test prefixes that don't exist in the map. - assert_eq!(collect(btree.range(key(0)..)), vec![]); - assert_eq!(collect(btree.range(key(10)..)), vec![]); - assert_eq!(collect(btree.range(key(100)..)), vec![]); + assert_eq!(collect_entry(btree.range(key(0)..)), vec![]); + assert_eq!(collect_entry(btree.range(key(10)..)), vec![]); + assert_eq!(collect_entry(btree.range(key(100)..)), vec![]); }); } btree_test!(test_range_empty, range_empty); @@ -2442,7 +2454,7 @@ mod test { btree.insert(key(0), value(0)); // Test a prefix that's larger than the value in the leaf node. Should be empty. - assert_eq!(collect(btree.range(key(1)..)), vec![]); + assert_eq!(collect_entry(btree.range(key(1)..)), vec![]); }); } btree_test!( @@ -2465,7 +2477,7 @@ mod test { // Test a prefix that's larger than the key in the internal node. assert_eq!( - collect(btree.range(key(7)..key(8))), + collect_entry(btree.range(key(7)..key(8))), vec![(key(7), value(7))] ); }); @@ -2506,7 +2518,7 @@ mod test { // Tests a prefix that's smaller than the key in the internal node. assert_eq!( - collect(btree.range(key(0)..key(11))), + collect_entry(btree.range(key(0)..key(11))), vec![ (key(1), value(100)), (key(2), value(200)), @@ -2517,7 +2529,7 @@ mod test { // Tests a prefix that crosses several nodes. assert_eq!( - collect(btree.range(key(10)..key(20))), + collect_entry(btree.range(key(10)..key(20))), vec![ (key(11), value(500)), (key(12), value(600)), @@ -2528,7 +2540,7 @@ mod test { // Tests a prefix that's larger than the key in the internal node. assert_eq!( - collect(btree.range(key(20)..key(30))), + collect_entry(btree.range(key(20)..key(30))), vec![ (key(21), value(900)), (key(22), value(1_000)), @@ -2618,11 +2630,11 @@ mod test { ); // Tests a prefix that doesn't exist, but is in the middle of the root node. - assert_eq!(collect(btree.range(key(15)..key(16))), vec![]); + assert_eq!(collect_entry(btree.range(key(15)..key(16))), vec![]); // Tests a prefix beginning in the middle of the tree and crossing several nodes. assert_eq!( - collect(btree.range(key(15)..=key(26))), + collect_entry(btree.range(key(15)..=key(26))), vec![ (key(16), value(700)), (key(18), value(800)), @@ -2638,7 +2650,7 @@ mod test { // Tests a prefix that crosses several nodes. assert_eq!( - collect(btree.range(key(10)..key(20))), + collect_entry(btree.range(key(10)..key(20))), vec![ (key(12), value(500)), (key(14), value(600)), @@ -2651,7 +2663,7 @@ mod test { // Tests a prefix that starts from a leaf node, then iterates through the root and right // sibling. assert_eq!( - collect(btree.range(key(20)..key(30))), + collect_entry(btree.range(key(20)..key(30))), vec![ (key(21), value(1000)), (key(22), value(1100)), @@ -2681,19 +2693,19 @@ mod test { // Check range [0, MID): should yield exactly the first MID entries. let keys: Vec<_> = btree.range(key(0)..key(MID)).collect(); assert_eq!(keys.len(), MID as usize); - for (i, (k, v)) in keys.into_iter().enumerate() { + for (i, entry) in keys.into_iter().enumerate() { let j = i as u32; - assert_eq!(k, key(j)); - assert_eq!(v, value(j)); + assert_eq!(*entry.key(), key(j)); + assert_eq!(entry.value(), value(j)); } // Check range [MID, TOTAL): should yield the remaining entries. let keys: Vec<_> = btree.range(key(MID)..).collect(); assert_eq!(keys.len(), (TOTAL - MID) as usize); - for (i, (k, v)) in keys.into_iter().enumerate() { + for (i, entry) in keys.into_iter().enumerate() { let j = MID + i as u32; - assert_eq!(k, key(j)); - assert_eq!(v, value(j)); + assert_eq!(*entry.key(), key(j)); + assert_eq!(entry.value(), value(j)); } }); } @@ -2729,7 +2741,7 @@ mod test { assert_eq!(root.children_len(), 2); assert_eq!( - collect(btree.range(key(0)..key(10))), + collect_entry(btree.range(key(0)..key(10))), vec![ (key(1), value(100)), (key(2), value(200)), @@ -2740,12 +2752,12 @@ mod test { // Tests an offset that has a keys somewhere in the range of keys of an internal node. assert_eq!( - collect(btree.range(key(13)..key(20))), + collect_entry(btree.range(key(13)..key(20))), vec![(key(13), value(700)), (key(14), value(800))] ); // Tests an offset that's larger than the key in the internal node. - assert_eq!(collect(btree.range(key(25)..)), vec![]); + assert_eq!(collect_entry(btree.range(key(25)..)), vec![]); }); } btree_test!( @@ -2830,7 +2842,7 @@ mod test { // Tests a offset that crosses several nodes. assert_eq!( - collect(btree.range(key(14)..key(20))), + collect_entry(btree.range(key(14)..key(20))), vec![ (key(14), value(0)), (key(16), value(0)), @@ -2842,7 +2854,7 @@ mod test { // Tests a offset that starts from a leaf node, then iterates through the root and right // sibling. assert_eq!( - collect(btree.range(key(22)..key(30))), + collect_entry(btree.range(key(22)..key(30))), vec![ (key(22), value(0)), (key(23), value(0)), @@ -2937,22 +2949,25 @@ mod test { stable_map.insert(key(i), value(i)); } - assert_eq!(collect_kv(std_map.range(..)), collect(stable_map.range(..))); + assert_eq!( + collect_kv(std_map.range(..)), + collect_entry(stable_map.range(..)) + ); for l in 0..=NKEYS { assert_eq!( collect_kv(std_map.range(key(l)..)), - collect(stable_map.range(key(l)..)) + collect_entry(stable_map.range(key(l)..)) ); assert_eq!( collect_kv(std_map.range(..key(l))), - collect(stable_map.range(..key(l))) + collect_entry(stable_map.range(..key(l))) ); assert_eq!( collect_kv(std_map.range(..=key(l))), - collect(stable_map.range(..=key(l))) + collect_entry(stable_map.range(..=key(l))) ); for r in l + 1..=NKEYS { @@ -2961,7 +2976,7 @@ mod test { let range = (lbound.clone(), rbound); assert_eq!( collect_kv(std_map.range(range.clone())), - collect(stable_map.range(range.clone())), + collect_entry(stable_map.range(range.clone())), "range: {range:?}" ); } @@ -2979,14 +2994,20 @@ mod test { btree.insert(key(j), value(j)); for i in 0..=j { assert_eq!( - btree.iter_from_prev_key(&key(i + 1)).next(), + btree + .iter_from_prev_key(&key(i + 1)) + .next() + .map(|entry| entry.into_pair()), Some((key(i), value(i))), "failed to get an upper bound for key({})", i + 1 ); } assert_eq!( - btree.iter_from_prev_key(&key(0)).next(), + btree + .iter_from_prev_key(&key(0)) + .next() + .map(|entry| entry.into_pair()), None, "key(0) must not have an upper bound" ); diff --git a/src/btreemap/iter.rs b/src/btreemap/iter.rs index 75483152..4d9e6e22 100644 --- a/src/btreemap/iter.rs +++ b/src/btreemap/iter.rs @@ -5,11 +5,12 @@ use super::{ use crate::{types::NULL, Address, Memory, Storable}; use std::borrow::Cow; use std::ops::{Bound, RangeBounds}; +use std::rc::Rc; /// An indicator of the current position in the map. pub(crate) enum Cursor { Address(Address), - Node { node: Box>, next: Index }, + Node { node: Rc>, next: Index }, } /// An index into a node's child or entry. @@ -100,7 +101,7 @@ where // We found the key exactly matching the left bound. // Here is where we'll start the iteration. self.forward_cursors.push(Cursor::Node { - node: Box::new(node), + node: Rc::new(node), next: Index::Entry(idx), }); break; @@ -118,7 +119,7 @@ where && self.range.contains(node.key(idx + 1, self.map.memory())) { self.forward_cursors.push(Cursor::Node { - node: Box::new(node), + node: Rc::new(node), next: Index::Entry(idx + 1), }); } @@ -156,7 +157,7 @@ where && self.range.contains(node.key(idx, self.map.memory())) { self.forward_cursors.push(Cursor::Node { - node: Box::new(node), + node: Rc::new(node), next: Index::Entry(idx), }); } @@ -196,7 +197,7 @@ where // We found the key exactly matching the right bound. // Here is where we'll start the iteration. self.backward_cursors.push(Cursor::Node { - node: Box::new(node), + node: Rc::new(node), next: Index::Entry(idx), }); break; @@ -214,7 +215,7 @@ where && self.range.contains(node.key(idx - 1, self.map.memory())) { self.backward_cursors.push(Cursor::Node { - node: Box::new(node), + node: Rc::new(node), next: Index::Entry(idx - 1), }); } @@ -250,7 +251,7 @@ where if idx > 0 && self.range.contains(node.key(idx - 1, self.map.memory())) { self.backward_cursors.push(Cursor::Node { - node: Box::new(node), + node: Rc::new(node), next: Index::Entry(idx - 1), }); } @@ -275,7 +276,7 @@ where // Iterates to find the next element in the requested range. // If it exists, `map` is applied to that element and the result is returned. - fn next_map, usize) -> T>(&mut self, map: F) -> Option { + fn next_map>, usize) -> T>(&mut self, map: F) -> Option { if !self.forward_cursors_initialized { self.initialize_forward_cursors(); } @@ -293,7 +294,7 @@ where // Iterate on leaf nodes starting from the first entry. NodeType::Leaf => Index::Entry(0), }, - node: Box::new(node), + node: Rc::new(node), }); } self.next_map(map) @@ -355,7 +356,7 @@ where // Iterates to find the next back element in the requested range. // If it exists, `map` is applied to that element and the result is returned. - fn next_back_map, usize) -> T>(&mut self, map: F) -> Option { + fn next_back_map>, usize) -> T>(&mut self, map: F) -> Option { if !self.backward_cursors_initialized { self.initialize_backward_cursors(); } @@ -379,7 +380,7 @@ where } { self.backward_cursors.push(Cursor::Node { next, - node: Box::new(node), + node: Rc::new(node), }); } } @@ -446,24 +447,63 @@ where } } +/// A lazily evaluated key-value entry from a `BTreeMap` iterator. +/// +/// This struct defers deserialization and cloning of the key and value +/// until they are explicitly accessed, improving performance. +pub struct LazyEntry<'a, K, V, M> +where + K: Storable + Ord + Clone, + V: Storable, + M: Memory, +{ + node: Rc>, + entry_idx: usize, + map: &'a BTreeMap, +} + +impl LazyEntry<'_, K, V, M> +where + K: Storable + Ord + Clone, + V: Storable, + M: Memory, +{ + /// Returns a reference to the key. + pub fn key(&self) -> &K { + self.node.key(self.entry_idx, self.map.memory()) + } + + /// Returns the value by deserializing it. + pub fn value(&self) -> V { + let encoded_value = self.node.value(self.entry_idx, self.map.memory()); + V::from_bytes(Cow::Borrowed(encoded_value)) + } + + /// Converts the entry into an owned (K, V) pair. + pub fn into_pair(self) -> (K, V) { + (self.key().clone(), self.value()) + } +} + pub struct Iter<'a, K, V, M>(IterInternal<'a, K, V, M>) where K: Storable + Ord + Clone, V: Storable, M: Memory; -impl Iterator for Iter<'_, K, V, M> +impl<'a, K, V, M> Iterator for Iter<'a, K, V, M> where K: Storable + Ord + Clone, V: Storable, M: Memory, { - type Item = (K, V); + type Item = LazyEntry<'a, K, V, M>; fn next(&mut self) -> Option { - self.0.next_map(|node, entry_idx| { - let (key, encoded_value) = node.entry(entry_idx, self.0.map.memory()); - (key.clone(), V::from_bytes(Cow::Borrowed(encoded_value))) + self.0.next_map(|node, entry_idx| LazyEntry { + node: node.clone(), + entry_idx, + map: self.0.map, }) } @@ -482,9 +522,10 @@ where M: Memory, { fn next_back(&mut self) -> Option { - self.0.next_back_map(|node, entry_idx| { - let (key, encoded_value) = node.entry(entry_idx, self.0.map.memory()); - (key.clone(), V::from_bytes(Cow::Borrowed(encoded_value))) + self.0.next_back_map(|node, entry_idx| LazyEntry { + node: node.clone(), + entry_idx, + map: self.0.map, }) } } @@ -624,9 +665,9 @@ mod test { } let mut i = 0; - for (key, value) in btree.iter() { - assert_eq!(key, i); - assert_eq!(value, i + 1); + for entry in btree.iter() { + assert_eq!(*entry.key(), i); + assert_eq!(entry.value(), i + 1); i += 1; } @@ -645,9 +686,9 @@ mod test { // Iteration should be in ascending order. let mut i = 0; - for (key, value) in btree.iter() { - assert_eq!(key, i); - assert_eq!(value, i + 1); + for entry in btree.iter() { + assert_eq!(*entry.key(), i); + assert_eq!(entry.value(), i + 1); i += 1; } @@ -666,9 +707,9 @@ mod test { // Iteration should be in ascending order. let mut i = 10; - for (key, value) in btree.range(10..90) { - assert_eq!(key, i); - assert_eq!(value, i + 1); + for entry in btree.range(10..90) { + assert_eq!(*entry.key(), i); + assert_eq!(entry.value(), i + 1); i += 1; } @@ -687,10 +728,10 @@ mod test { // Iteration should be in descending order. let mut i = 100; - for (key, value) in btree.iter().rev() { + for entry in btree.iter().rev() { i -= 1; - assert_eq!(key, i); - assert_eq!(value, i + 1); + assert_eq!(*entry.key(), i); + assert_eq!(entry.value(), i + 1); } assert_eq!(i, 0); @@ -708,10 +749,10 @@ mod test { // Iteration should be in descending order. let mut i = 80; - for (key, value) in btree.range(20..80).rev() { + for entry in btree.range(20..80).rev() { i -= 1; - assert_eq!(key, i); - assert_eq!(value, i + 1); + assert_eq!(*entry.key(), i); + assert_eq!(entry.value(), i + 1); } assert_eq!(i, 20); @@ -730,13 +771,13 @@ mod test { let mut iter = btree.iter(); for i in 0..50 { - let (key, value) = iter.next().unwrap(); - assert_eq!(key, i); - assert_eq!(value, i + 1); + let entry = iter.next().unwrap(); + assert_eq!(*entry.key(), i); + assert_eq!(entry.value(), i + 1); - let (key, value) = iter.next_back().unwrap(); - assert_eq!(key, 99 - i); - assert_eq!(value, 100 - i); + let entry = iter.next_back().unwrap(); + assert_eq!(*entry.key(), 99 - i); + assert_eq!(entry.value(), 100 - i); } assert!(iter.next().is_none()); @@ -756,13 +797,13 @@ mod test { let mut iter = btree.range(30..70); for i in 0..20 { - let (key, value) = iter.next().unwrap(); - assert_eq!(key, 30 + i); - assert_eq!(value, 31 + i); + let entry = iter.next().unwrap(); + assert_eq!(*entry.key(), 30 + i); + assert_eq!(entry.value(), 31 + i); - let (key, value) = iter.next_back().unwrap(); - assert_eq!(key, 69 - i); - assert_eq!(value, 70 - i); + let entry = iter.next_back().unwrap(); + assert_eq!(*entry.key(), 69 - i); + assert_eq!(entry.value(), 70 - i); } assert!(iter.next().is_none()); diff --git a/src/btreemap/proptests.rs b/src/btreemap/proptests.rs index 16c7cc99..4403a42b 100644 --- a/src/btreemap/proptests.rs +++ b/src/btreemap/proptests.rs @@ -146,7 +146,12 @@ fn map_iter_from_prev_key(#[strategy(pvec(0u64..u64::MAX -1 , 10..100))] keys: V for k in keys.iter() { map.insert(*k, ()); - prop_assert_eq!(Some((*k, ())), map.iter_from_prev_key(&(k + 1)).next()); + prop_assert_eq!( + Some((*k, ())), + map.iter_from_prev_key(&(k + 1)) + .next() + .map(|entry| entry.into_pair()) + ); } Ok(()) @@ -215,7 +220,7 @@ fn execute_operation( let std_iter = std_btree.iter().skip(from).take(len); let mut stable_iter = btree.iter().skip(from).take(len); for (k1, v1) in std_iter { - let (k2, v2) = stable_iter.next().unwrap(); + let (k2, v2) = stable_iter.next().map(|entry| entry.into_pair()).unwrap(); assert_eq!(k1, &k2); assert_eq!(v1, &v2); } @@ -234,7 +239,7 @@ fn execute_operation( let std_iter = std_btree.iter().rev().skip(from).take(len); let mut stable_iter = btree.iter().rev().skip(from).take(len); for (k1, v1) in std_iter { - let (k2, v2) = stable_iter.next().unwrap(); + let (k2, v2) = stable_iter.next().map(|entry| entry.into_pair()).unwrap(); assert_eq!(k1, &k2); assert_eq!(v1, &v2); } @@ -283,7 +288,13 @@ fn execute_operation( } let idx = idx % std_btree.len(); - if let Some((k, v)) = btree.iter().skip(idx).take(1).next() { + if let Some((k, v)) = btree + .iter() + .skip(idx) + .take(1) + .next() + .map(|entry| entry.into_pair()) + { eprintln!("Get({})", hex::encode(&k)); assert_eq!(std_btree.get(&k), Some(&v)); assert_eq!(btree.get(&k), Some(v)); @@ -297,7 +308,13 @@ fn execute_operation( let idx = idx % std_btree.len(); - if let Some((k, v)) = btree.iter().skip(idx).take(1).next() { + if let Some((k, v)) = btree + .iter() + .skip(idx) + .take(1) + .next() + .map(|entry| entry.into_pair()) + { eprintln!("Remove({})", hex::encode(&k)); assert_eq!(std_btree.remove(&k), Some(v.clone())); assert_eq!(btree.remove(&k), Some(v)); @@ -314,9 +331,27 @@ fn execute_operation( let end = std::cmp::min(std_btree.len() - 1, from + len); // Create a range for the stable btree from the keys at indexes `from` and `end`. - let range_start = btree.iter().skip(from).take(1).next().unwrap().0.clone(); - let range_end = btree.iter().skip(end).take(1).next().unwrap().0.clone(); - let stable_range = btree.range(range_start..range_end); + let range_start = btree + .iter() + .skip(from) + .take(1) + .next() + .map(|entry| entry.into_pair()) + .unwrap() + .0 + .clone(); + let range_end = btree + .iter() + .skip(end) + .take(1) + .next() + .map(|entry| entry.into_pair()) + .unwrap() + .0 + .clone(); + let stable_range = btree + .range(range_start..range_end) + .map(|entry| entry.into_pair()); // Create a range for the std btree from the keys at indexes `from` and `end`. let range_start = std_btree diff --git a/src/btreeset.rs b/src/btreeset.rs index 8257eec1..d4853b15 100644 --- a/src/btreeset.rs +++ b/src/btreeset.rs @@ -35,7 +35,7 @@ where type Item = K; fn next(&mut self) -> Option { - self.iter_internal.next().map(|(a, _)| a) + self.iter_internal.next().map(|entry| entry.key().clone()) } } diff --git a/tests/api_conformance.rs b/tests/api_conformance.rs index cbe9dd58..3f81394c 100644 --- a/tests/api_conformance.rs +++ b/tests/api_conformance.rs @@ -57,7 +57,10 @@ fn api_conformance_btreemap() { // Iterators. // Note: stable.iter() yields (K, V), std.iter() yields (&K, &V) - let stable_items: std::vec::Vec<_> = stable.iter().collect(); + let stable_items: std::vec::Vec<_> = stable + .iter() + .map(|entry| (*entry.key(), entry.value())) + .collect(); let std_items: std::vec::Vec<_> = std.iter().map(|(k, v)| (*k, v.clone())).collect(); assert_eq!(stable_items, std_items); @@ -93,7 +96,10 @@ fn api_conformance_btreemap() { let range_start = 3; let range_end = 7; - let stable_range: std::vec::Vec<_> = stable.range(range_start..range_end).collect(); + let stable_range: std::vec::Vec<_> = stable + .range(range_start..range_end) + .map(|entry| (*entry.key(), entry.value())) + .collect(); let std_range: std::vec::Vec<_> = std .range(range_start..range_end) .map(|(k, v)| (*k, v.clone())) @@ -123,7 +129,10 @@ fn api_conformance_btreemap() { // To simulate in std: use .range(..bound).next_back() to get the largest < bound, // then iterate from that key forward using .range(start..). let bound = 5; - let stable_result: std::vec::Vec<_> = stable.iter_from_prev_key(&bound).collect(); + let stable_result: std::vec::Vec<_> = stable + .iter_from_prev_key(&bound) + .map(|entry| (*entry.key(), entry.value())) + .collect(); let std_result: std::vec::Vec<_> = if let Some((start, _)) = std.range(..bound).next_back() { std.range(start..).map(|(k, v)| (*k, v.clone())).collect() } else {