From 00e438e227f2d87316bbc84a70df00e9ecba8265 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Thu, 2 Apr 2026 14:45:46 +0200 Subject: [PATCH] use cache for range/scan --- benchmarks/btreemap/canbench_results.yml | 336 +++++++++++------------ benchmarks/btreeset/canbench_results.yml | 200 +++++++------- benchmarks/nns/canbench_results.yml | 28 +- src/btreemap.rs | 13 + src/btreemap/iter.rs | 12 +- src/btreemap/node.rs | 72 +++++ src/btreemap/node_cache.rs | 21 ++ 7 files changed, 394 insertions(+), 288 deletions(-) diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index 6ca9d220..9c03047c 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -51,21 +51,21 @@ benches: btreemap_v2_contains_then_remove_blob_32_128: total: calls: 1 - instructions: 935182118 + instructions: 932412822 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_then_remove_u64_u64: total: calls: 1 - instructions: 740231860 + instructions: 737869743 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_then_remove_u64_u64_nocache: total: calls: 1 - instructions: 785607136 + instructions: 783245019 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -345,42 +345,42 @@ benches: btreemap_v2_get_then_insert_blob_32_128: total: calls: 1 - instructions: 772136939 + instructions: 770898083 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_insert_u64_u64: total: calls: 1 - instructions: 542500156 + instructions: 541513961 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_insert_u64_u64_nocache: total: calls: 1 - instructions: 594578003 + instructions: 593591808 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_remove_blob_32_128: total: calls: 1 - instructions: 966918469 + instructions: 964076379 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_remove_u64_u64: total: calls: 1 - instructions: 744770315 + instructions: 742408198 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_then_remove_u64_u64_nocache: total: calls: 1 - instructions: 790139692 + instructions: 787777575 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -576,343 +576,343 @@ benches: btreemap_v2_insert_100k_u64_u64: total: calls: 1 - instructions: 4783069961 + instructions: 4769676412 heap_increase: 0 stable_memory_increase: 60 scopes: {} btreemap_v2_insert_10mib_values: total: calls: 1 - instructions: 4389920873 + instructions: 4388594188 heap_increase: 161 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 438891007 + instructions: 437341515 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: calls: 1 - instructions: 5498621739 + instructions: 5496966231 heap_increase: 0 stable_memory_increase: 196 scopes: {} btreemap_v2_insert_blob_128_128: total: calls: 1 - instructions: 1183240670 + instructions: 1181584128 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: calls: 1 - instructions: 488586148 + instructions: 486978038 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: calls: 1 - instructions: 1791440822 + instructions: 1789782958 heap_increase: 0 stable_memory_increase: 67 scopes: {} btreemap_v2_insert_blob_32_0: total: calls: 1 - instructions: 492829237 + instructions: 491195892 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_1024: total: calls: 1 - instructions: 705873529 + instructions: 704237583 heap_increase: 0 stable_memory_increase: 173 scopes: {} btreemap_v2_insert_blob_32_128: total: calls: 1 - instructions: 544934108 + instructions: 543303072 heap_increase: 0 stable_memory_increase: 28 scopes: {} btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 521502709 + instructions: 519857320 heap_increase: 0 stable_memory_increase: 11 scopes: {} btreemap_v2_insert_blob_32_256: total: calls: 1 - instructions: 573067512 + instructions: 571428278 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: calls: 1 - instructions: 531331458 + instructions: 529690750 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 511755349 + instructions: 510118290 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: calls: 1 - instructions: 612438263 + instructions: 610801901 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: calls: 1 - instructions: 537296782 + instructions: 535658596 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: calls: 1 - instructions: 519958093 + instructions: 518328255 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: calls: 1 - instructions: 409378756 + instructions: 407931437 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_512_128: total: calls: 1 - instructions: 3043628657 + instructions: 3041969195 heap_increase: 0 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: calls: 1 - instructions: 663570679 + instructions: 661920389 heap_increase: 0 stable_memory_increase: 34 scopes: {} btreemap_v2_insert_blob_8_128: total: calls: 1 - instructions: 460891400 + instructions: 459320342 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_overwrite_u64_u64: total: calls: 1 - instructions: 361880515 + instructions: 360894320 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_overwrite_u64_u64_nocache: total: calls: 1 - instructions: 361439987 + instructions: 360453792 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_overwrite_zipf_10k_u64_u64: total: calls: 1 - instructions: 351678455 + instructions: 350721014 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_principal: total: calls: 1 - instructions: 504411405 + instructions: 502766299 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_seq_u64_u64: total: calls: 1 - instructions: 475747680 + instructions: 474216184 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_seq_u64_u64_nocache: total: calls: 1 - instructions: 475044736 + instructions: 473513240 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 408807071 + instructions: 407467741 heap_increase: 0 stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: calls: 1 - instructions: 416641538 + instructions: 415303293 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 412435236 + instructions: 411095302 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 595085830 + instructions: 593518246 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2745312743 + instructions: 2744018189 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1013486767 + instructions: 1012063622 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 709962271 + instructions: 708410203 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1402961414 + instructions: 1401632953 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_0: total: calls: 1 - instructions: 622901933 + instructions: 621268221 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1183025750 + instructions: 1181547120 heap_increase: 0 stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 757068356 + instructions: 755515146 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 667248591 + instructions: 665604493 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 870137550 + instructions: 868642505 heap_increase: 0 stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 662703096 + instructions: 661062388 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 661403160 + instructions: 659766006 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 974550283 + instructions: 973078294 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 692676738 + instructions: 691053139 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 660889456 + instructions: 659259716 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 605196201 + instructions: 603794760 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1859866730 + instructions: 1858577349 heap_increase: 0 stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 847258662 + instructions: 845729326 heap_increase: 0 stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 667223395 + instructions: 665701481 heap_increase: 0 stable_memory_increase: 23 scopes: {} @@ -996,770 +996,770 @@ benches: btreemap_v2_mem_manager_get_u64_u64: total: calls: 1 - instructions: 213163935 + instructions: 213126867 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_vec512: total: calls: 1 - instructions: 276514725 + instructions: 275679057 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_vec512_u64: total: calls: 1 - instructions: 939857595 + instructions: 938992119 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_blob512_u64: total: calls: 1 - instructions: 3128614878 + instructions: 3128406144 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_blob512: total: calls: 1 - instructions: 608204362 + instructions: 607994424 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_u64: total: calls: 1 - instructions: 521480782 + instructions: 521232348 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_vec512: total: calls: 1 - instructions: 836012178 + instructions: 834352214 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: calls: 1 - instructions: 1966511677 + instructions: 1964860987 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_blob512_u64: total: calls: 1 - instructions: 4317279925 + instructions: 4316962869 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_blob512: total: calls: 1 - instructions: 884294544 + instructions: 883979552 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_u64: total: calls: 1 - instructions: 740622806 + instructions: 740259490 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_vec512: total: calls: 1 - instructions: 1225617749 + instructions: 1223514541 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_vec512_u64: total: calls: 1 - instructions: 3091695677 + instructions: 3089598193 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mixed_get_insert_zipf_10k_u64_u64: total: calls: 1 - instructions: 499914751 + instructions: 498957310 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mixed_get_insert_zipf_10k_u64_u64_nocache: total: calls: 1 - instructions: 568541315 + instructions: 567583874 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_peek_then_pop_first_u64_u64: total: calls: 1 - instructions: 651744950 + instructions: 649777598 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_peek_then_pop_last_u64_u64: total: calls: 1 - instructions: 644042314 + instructions: 642073351 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_peek_then_pop_last_u64_u64_nocache: total: calls: 1 - instructions: 863829827 + instructions: 861860864 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: calls: 1 - instructions: 2563046017 + instructions: 2560599461 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_0: total: calls: 1 - instructions: 675954446 + instructions: 673612885 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: calls: 1 - instructions: 1012361706 + instructions: 1010014042 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: calls: 1 - instructions: 765982003 + instructions: 763615873 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: calls: 1 - instructions: 532398781 + instructions: 530513907 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_principal: total: calls: 1 - instructions: 707659441 + instructions: 705280275 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: calls: 1 - instructions: 606501460 + instructions: 604534108 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 1006110791 + instructions: 1003844912 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_vec128: total: calls: 1 - instructions: 1006110791 + instructions: 1003844912 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: calls: 1 - instructions: 2470730714 + instructions: 2468283856 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_0: total: calls: 1 - instructions: 646592807 + instructions: 644248015 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: calls: 1 - instructions: 978992235 + instructions: 976646191 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: calls: 1 - instructions: 734719065 + instructions: 732350625 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 522357978 + instructions: 520473501 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_principal: total: calls: 1 - instructions: 693209769 + instructions: 690830083 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: calls: 1 - instructions: 586840408 + instructions: 584871445 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 980671184 + instructions: 978403592 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_vec128: total: calls: 1 - instructions: 980671184 + instructions: 978403592 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_0b: total: calls: 1 - instructions: 16962 + instructions: 17314 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_10kib: total: calls: 1 - instructions: 2507196 + instructions: 2525585 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_20_10mib: total: calls: 1 - instructions: 18468765 + instructions: 18469122 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_0b: total: calls: 1 - instructions: 16933 + instructions: 17285 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_10kib: total: calls: 1 - instructions: 2572994 + instructions: 2591383 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_20_10mib: total: calls: 1 - instructions: 18469999 + instructions: 18470356 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_small_u64_u64: total: calls: 1 - instructions: 18511700 + instructions: 18793840 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_0b: total: calls: 1 - instructions: 17300 + instructions: 17650 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_10kib: total: calls: 1 - instructions: 20668618 + instructions: 20686339 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_20_10mib: total: calls: 1 - instructions: 398305226 + instructions: 398305569 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_100k_u64_u64: total: calls: 1 - instructions: 7022692402 + instructions: 6996632664 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_100k_u64_u64_nocache: total: calls: 1 - instructions: 6946036989 + instructions: 6919977251 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_10mib_values: total: calls: 1 - instructions: 4711743233 + instructions: 4711120324 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 589474565 + instructions: 587020522 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: calls: 1 - instructions: 7376484425 + instructions: 7373526323 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: calls: 1 - instructions: 1593634275 + instructions: 1590703453 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: calls: 1 - instructions: 670124837 + instructions: 667339921 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: calls: 1 - instructions: 2427157860 + instructions: 2424213606 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_0: total: calls: 1 - instructions: 659537403 + instructions: 656645504 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: calls: 1 - instructions: 988057066 + instructions: 985209950 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: calls: 1 - instructions: 751001305 + instructions: 748159215 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: calls: 1 - instructions: 705881103 + instructions: 703054055 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 788310166 + instructions: 785473890 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: calls: 1 - instructions: 717055240 + instructions: 714216914 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 702694917 + instructions: 699820949 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: calls: 1 - instructions: 862386341 + instructions: 859505907 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: calls: 1 - instructions: 742478425 + instructions: 739561961 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 701873440 + instructions: 699051294 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: calls: 1 - instructions: 455594905 + instructions: 453906287 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: calls: 1 - instructions: 4079560625 + instructions: 4076601783 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: calls: 1 - instructions: 914727976 + instructions: 911899432 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: calls: 1 - instructions: 603742474 + instructions: 601247144 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_principal: total: calls: 1 - instructions: 689802715 + instructions: 686846976 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 570830806 + instructions: 568486229 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: calls: 1 - instructions: 592564033 + instructions: 590201916 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_vec8: total: calls: 1 - instructions: 575957691 + instructions: 573611064 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 760926731 + instructions: 758401423 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4481754088 + instructions: 4479573779 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1437976876 + instructions: 1435444054 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 921437947 + instructions: 918712507 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2247133745 + instructions: 2244829461 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_0: total: calls: 1 - instructions: 839222274 + instructions: 836357336 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1699140827 + instructions: 1696712002 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1039734400 + instructions: 1037028363 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 874337216 + instructions: 871511226 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1256268362 + instructions: 1253674213 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 871500163 + instructions: 868662075 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 868223400 + instructions: 865349268 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1407502741 + instructions: 1404987779 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 972053378 + instructions: 969157421 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 860909525 + instructions: 858067455 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 662018544 + instructions: 660309007 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 3085402195 + instructions: 3083171643 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1186045982 + instructions: 1183396319 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 824084166 + instructions: 821637735 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_zipf_10k_u64_u64: total: calls: 1 - instructions: 344394694 + instructions: 343713407 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_0b: total: calls: 1 - instructions: 975992 + instructions: 994401 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_10kib: total: calls: 1 - instructions: 2491763 + instructions: 2510172 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_20_10mib: total: calls: 1 - instructions: 18467176 + instructions: 18467543 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_0b: total: calls: 1 - instructions: 978166 + instructions: 989600 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_10kib: total: calls: 1 - instructions: 2475597 + instructions: 2487031 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_20_10mib: total: calls: 1 - instructions: 18467168 + instructions: 18467400 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_0b: total: calls: 1 - instructions: 982657 + instructions: 1007659 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_10kib: total: calls: 1 - instructions: 2498428 + instructions: 2523430 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_20_10mib: total: calls: 1 - instructions: 18467320 + instructions: 18467818 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_0b: total: calls: 1 - instructions: 984223 + instructions: 1000855 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_10kib: total: calls: 1 - instructions: 2481654 + instructions: 2498286 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_20_10mib: total: calls: 1 - instructions: 18467298 + instructions: 18467634 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_0b: total: calls: 1 - instructions: 1230992 + instructions: 1247401 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_10kib: total: calls: 1 - instructions: 56740279 + instructions: 56756688 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_20_10mib: total: calls: 1 - instructions: 1103710894 + instructions: 1103711221 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_0b: total: calls: 1 - instructions: 1231498 + instructions: 1240932 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_10kib: total: calls: 1 - instructions: 56683107 + instructions: 56692541 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_20_10mib: total: calls: 1 - instructions: 1103710405 + instructions: 1103710597 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/btreeset/canbench_results.yml b/benchmarks/btreeset/canbench_results.yml index 7031b5e1..e54ef733 100644 --- a/benchmarks/btreeset/canbench_results.yml +++ b/benchmarks/btreeset/canbench_results.yml @@ -2,700 +2,700 @@ benches: btreeset_insert_blob_1024: total: calls: 1 - instructions: 7266956788 + instructions: 7268345758 heap_increase: 1 stable_memory_increase: 256 scopes: {} btreeset_insert_blob_128: total: calls: 1 - instructions: 1637831818 + instructions: 1639225754 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_16: total: calls: 1 - instructions: 716728742 + instructions: 717808022 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_256: total: calls: 1 - instructions: 2446289537 + instructions: 2447682769 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_32: total: calls: 1 - instructions: 815783126 + instructions: 816945863 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_512: total: calls: 1 - instructions: 4050903852 + instructions: 4052295668 heap_increase: 0 stable_memory_increase: 128 scopes: {} btreeset_insert_blob_64: total: calls: 1 - instructions: 981533677 + instructions: 982826379 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_blob_8: total: calls: 1 - instructions: 695107777 + instructions: 695432971 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_u32: total: calls: 1 - instructions: 541229279 + instructions: 541159313 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_insert_u64: total: calls: 1 - instructions: 562562358 + instructions: 562525688 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_1024: total: calls: 1 - instructions: 101680337 + instructions: 101720077 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_128: total: calls: 1 - instructions: 16712295 + instructions: 16752035 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_16: total: calls: 1 - instructions: 3049602 + instructions: 3089303 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_256: total: calls: 1 - instructions: 28981189 + instructions: 29020929 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_32: total: calls: 1 - instructions: 4315571 + instructions: 4355279 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_512: total: calls: 1 - instructions: 53201464 + instructions: 53241204 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_64: total: calls: 1 - instructions: 9211343 + instructions: 9251077 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_blob_8: total: calls: 1 - instructions: 2793050 + instructions: 2831563 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_u32: total: calls: 1 - instructions: 1921673 + instructions: 1960097 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_intersection_u64: total: calls: 1 - instructions: 1964949 + instructions: 2003379 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_1024: total: calls: 1 - instructions: 43769567 + instructions: 43796452 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_128: total: calls: 1 - instructions: 7897406 + instructions: 7924291 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_16: total: calls: 1 - instructions: 1907832 + instructions: 1934678 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_256: total: calls: 1 - instructions: 13164529 + instructions: 13191414 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_32: total: calls: 1 - instructions: 2539466 + instructions: 2566319 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_512: total: calls: 1 - instructions: 23366500 + instructions: 23393385 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_64: total: calls: 1 - instructions: 4381408 + instructions: 4408287 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_blob_8: total: calls: 1 - instructions: 1850635 + instructions: 1876673 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_u32: total: calls: 1 - instructions: 1316543 + instructions: 1342525 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_disjoint_u64: total: calls: 1 - instructions: 1343356 + instructions: 1369338 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_1024: total: calls: 1 - instructions: 358419 + instructions: 359217 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_128: total: calls: 1 - instructions: 85062 + instructions: 85860 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_16: total: calls: 1 - instructions: 53155 + instructions: 53953 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_256: total: calls: 1 - instructions: 124179 + instructions: 124977 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_32: total: calls: 1 - instructions: 44795 + instructions: 45593 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_512: total: calls: 1 - instructions: 202259 + instructions: 203057 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_64: total: calls: 1 - instructions: 55209 + instructions: 56007 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_blob_8: total: calls: 1 - instructions: 51777 + instructions: 52543 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_u32: total: calls: 1 - instructions: 42450 + instructions: 43216 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_subset_u64: total: calls: 1 - instructions: 43256 + instructions: 44022 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_1024: total: calls: 1 - instructions: 78740555 + instructions: 78780295 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_128: total: calls: 1 - instructions: 13352888 + instructions: 13392628 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_16: total: calls: 1 - instructions: 2920490 + instructions: 2960191 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_256: total: calls: 1 - instructions: 23003003 + instructions: 23042743 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_32: total: calls: 1 - instructions: 4069766 + instructions: 4109474 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_512: total: calls: 1 - instructions: 41561193 + instructions: 41600933 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_64: total: calls: 1 - instructions: 7266779 + instructions: 7306513 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_blob_8: total: calls: 1 - instructions: 2727094 + instructions: 2765607 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_u32: total: calls: 1 - instructions: 1921351 + instructions: 1959775 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_is_superset_u64: total: calls: 1 - instructions: 1961281 + instructions: 1999711 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_1024: total: calls: 1 - instructions: 430995530 + instructions: 431261230 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_128: total: calls: 1 - instructions: 74503150 + instructions: 74768850 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_16: total: calls: 1 - instructions: 14579696 + instructions: 14845396 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_256: total: calls: 1 - instructions: 125787984 + instructions: 126053684 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_32: total: calls: 1 - instructions: 20939791 + instructions: 21205491 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_512: total: calls: 1 - instructions: 227475530 + instructions: 227741230 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_64: total: calls: 1 - instructions: 39453577 + instructions: 39719277 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_blob_8: total: calls: 1 - instructions: 14004824 + instructions: 14262536 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_u32: total: calls: 1 - instructions: 10667867 + instructions: 10925579 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_iter_u64: total: calls: 1 - instructions: 10908079 + instructions: 11165791 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_1024: total: calls: 1 - instructions: 259870196 + instructions: 260030245 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_128: total: calls: 1 - instructions: 45508439 + instructions: 45668488 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_16: total: calls: 1 - instructions: 9508605 + instructions: 9668654 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_256: total: calls: 1 - instructions: 76456411 + instructions: 76616460 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_32: total: calls: 1 - instructions: 13294157 + instructions: 13454206 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_512: total: calls: 1 - instructions: 137589173 + instructions: 137749222 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_64: total: calls: 1 - instructions: 24443488 + instructions: 24603537 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_blob_8: total: calls: 1 - instructions: 9144616 + instructions: 9299865 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_u32: total: calls: 1 - instructions: 6480292 + instructions: 6635541 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_range_u64: total: calls: 1 - instructions: 6624379 + instructions: 6779628 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_1024: total: calls: 1 - instructions: 7723769472 + instructions: 7725109638 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_128: total: calls: 1 - instructions: 1667435780 + instructions: 1668775946 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_16: total: calls: 1 - instructions: 706481770 + instructions: 707736152 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_256: total: calls: 1 - instructions: 2535147032 + instructions: 2536487198 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_32: total: calls: 1 - instructions: 803118519 + instructions: 804266643 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_512: total: calls: 1 - instructions: 4262483247 + instructions: 4263823413 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_64: total: calls: 1 - instructions: 988152388 + instructions: 989410920 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_blob_8: total: calls: 1 - instructions: 684602545 + instructions: 685165617 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_u32: total: calls: 1 - instructions: 529154304 + instructions: 529220139 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_remove_u64: total: calls: 1 - instructions: 554060009 + instructions: 554188916 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_1024: total: calls: 1 - instructions: 101670997 + instructions: 101710738 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_128: total: calls: 1 - instructions: 16692203 + instructions: 16731944 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_16: total: calls: 1 - instructions: 3027274 + instructions: 3066976 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_256: total: calls: 1 - instructions: 28962633 + instructions: 29002374 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_32: total: calls: 1 - instructions: 4281313 + instructions: 4321022 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_512: total: calls: 1 - instructions: 53185980 + instructions: 53225721 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_64: total: calls: 1 - instructions: 9190483 + instructions: 9230218 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_blob_8: total: calls: 1 - instructions: 2776181 + instructions: 2814695 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_u32: total: calls: 1 - instructions: 1901309 + instructions: 1939734 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_symmetric_difference_u64: total: calls: 1 - instructions: 1935566 + instructions: 1973997 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_1024: total: calls: 1 - instructions: 101691006 + instructions: 101730747 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_128: total: calls: 1 - instructions: 16712212 + instructions: 16751953 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_16: total: calls: 1 - instructions: 3047765 + instructions: 3087467 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_256: total: calls: 1 - instructions: 28982642 + instructions: 29022383 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_32: total: calls: 1 - instructions: 4313788 + instructions: 4353497 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_512: total: calls: 1 - instructions: 53205989 + instructions: 53245730 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_64: total: calls: 1 - instructions: 9210492 + instructions: 9250227 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_blob_8: total: calls: 1 - instructions: 2791177 + instructions: 2829691 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_u32: total: calls: 1 - instructions: 1900823 + instructions: 1939248 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreeset_union_u64: total: calls: 1 - instructions: 1969072 + instructions: 2007503 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/nns/canbench_results.yml b/benchmarks/nns/canbench_results.yml index 95d38b97..8a764266 100644 --- a/benchmarks/nns/canbench_results.yml +++ b/benchmarks/nns/canbench_results.yml @@ -2,42 +2,42 @@ benches: vote_cascading_heap_centralized_10k: total: calls: 1 - instructions: 77755739 + instructions: 77758460 heap_increase: 16 stable_memory_increase: 0 scopes: {} vote_cascading_heap_centralized_1k: total: calls: 1 - instructions: 7816288 + instructions: 7815132 heap_increase: 1 stable_memory_increase: 0 scopes: {} vote_cascading_heap_chain_10k_15: total: calls: 1 - instructions: 1272077976 + instructions: 1272207053 heap_increase: 10 stable_memory_increase: 0 scopes: {} vote_cascading_heap_chain_10k_5: total: calls: 1 - instructions: 239410927 + instructions: 239648964 heap_increase: 10 stable_memory_increase: 0 scopes: {} vote_cascading_heap_chain_1k_15: total: calls: 1 - instructions: 124847103 + instructions: 124352570 heap_increase: 1 stable_memory_increase: 0 scopes: {} vote_cascading_heap_chain_1k_5: total: calls: 1 - instructions: 23958834 + instructions: 23867558 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -58,56 +58,56 @@ benches: vote_cascading_stable_centralized_10k: total: calls: 1 - instructions: 1372396240 + instructions: 1386449041 heap_increase: 10 stable_memory_increase: 0 scopes: {} vote_cascading_stable_centralized_1k: total: calls: 1 - instructions: 99761831 + instructions: 100903813 heap_increase: 1 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_10k_15: total: calls: 1 - instructions: 9854978344 + instructions: 9882597118 heap_increase: 5 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_10k_5: total: calls: 1 - instructions: 2924577184 + instructions: 3015844565 heap_increase: 5 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_1k_15: total: calls: 1 - instructions: 866392564 + instructions: 874649879 heap_increase: 0 stable_memory_increase: 0 scopes: {} vote_cascading_stable_chain_1k_5: total: calls: 1 - instructions: 251866705 + instructions: 253263477 heap_increase: 0 stable_memory_increase: 0 scopes: {} vote_cascading_stable_single_vote_10k: total: calls: 1 - instructions: 91198 + instructions: 92130 heap_increase: 0 stable_memory_increase: 0 scopes: {} vote_cascading_stable_single_vote_1k: total: calls: 1 - instructions: 66620 + instructions: 67376 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/src/btreemap.rs b/src/btreemap.rs index 80d1dea6..ad937ff0 100644 --- a/src/btreemap.rs +++ b/src/btreemap.rs @@ -1517,6 +1517,19 @@ where Node::load(address, self.version.page_size(), self.memory()) } + /// Returns a structural clone from the cache, or loads from memory. + /// + /// Unlike `take_or_load_node`, this does not remove the node from the cache. + /// Keys are cloned (for search), values stay unloaded (cheap). + /// Use this for read paths that consume the node (e.g. iterators). + #[inline(always)] + fn peek_or_load_node(&self, address: Address) -> Node { + if let Some(node) = self.cache.borrow_mut().peek(address) { + return node; + } + Node::load(address, self.version.page_size(), self.memory()) + } + /// Returns a node to the cache after use on a read path. /// /// `depth` is the distance from the root (root = 0), used by the diff --git a/src/btreemap/iter.rs b/src/btreemap/iter.rs index 4d9e6e22..025bb706 100644 --- a/src/btreemap/iter.rs +++ b/src/btreemap/iter.rs @@ -93,7 +93,7 @@ where .push(Cursor::Address(self.map.root_addr)); } Bound::Included(key) | Bound::Excluded(key) => { - let mut node = self.map.load_node(self.map.root_addr); + let mut node = self.map.peek_or_load_node(self.map.root_addr); loop { match node.search(key, self.map.memory()) { Ok(idx) => { @@ -148,7 +148,7 @@ where NodeType::Internal => { // Note that loading a child node cannot fail since // len(children) = len(entries) + 1 - Some(self.map.load_node(node.child(idx))) + Some(self.map.peek_or_load_node(node.child(idx))) } NodeType::Leaf => None, }; @@ -189,7 +189,7 @@ where .push(Cursor::Address(self.map.root_addr)); } Bound::Included(key) | Bound::Excluded(key) => { - let mut node = self.map.load_node(self.map.root_addr); + let mut node = self.map.peek_or_load_node(self.map.root_addr); loop { match node.search(key, self.map.memory()) { Ok(idx) => { @@ -243,7 +243,7 @@ where NodeType::Internal => { // Note that loading a child node cannot fail since // len(children) = len(entries) + 1 - Some(self.map.load_node(node.child(idx))) + Some(self.map.peek_or_load_node(node.child(idx))) } NodeType::Leaf => None, }; @@ -286,7 +286,7 @@ where Cursor::Address(address) => { if address != NULL { // Load the node at the given address, and add it to the cursors. - let node = self.map.load_node(address); + let node = self.map.peek_or_load_node(address); self.forward_cursors.push(Cursor::Node { next: match node.node_type() { // Iterate on internal nodes starting from the first child. @@ -366,7 +366,7 @@ where Cursor::Address(address) => { if address != NULL { // Load the node at the given address, and add it to the cursors. - let node = self.map.load_node(address); + let node = self.map.peek_or_load_node(address); if let Some(next) = match node.node_type() { // Iterate on internal nodes starting from the last child. NodeType::Internal if node.children_len() > 0 => { diff --git a/src/btreemap/node.rs b/src/btreemap/node.rs index 2efb5cd6..6ed34a18 100644 --- a/src/btreemap/node.rs +++ b/src/btreemap/node.rs @@ -67,6 +67,26 @@ pub struct Node { } impl Node { + /// Returns a cheap clone suitable for read-only navigation. + /// + /// Keys are cloned (preserving loaded state for search), values are reset + /// to their unloaded `ByRef` state so no value data is copied. Structural + /// fields (address, children, node type, version, overflows) are copied. + pub fn structural_clone(&self) -> Self { + Self { + address: self.address, + entries: self + .entries + .iter() + .map(|(k, v)| (k.clone_with_key(), v.shallow_clone())) + .collect(), + children: self.children.clone(), + node_type: self.node_type, + version: self.version, + overflows: self.overflows.clone(), + } + } + /// Loads a node from memory at the given address. pub fn load(address: Address, page_size: PageSize, memory: &M) -> Self { // Load the header to determine which version the node is, then load the node accordingly. @@ -504,6 +524,23 @@ enum LazyObject { } impl LazyObject { + /// Returns a deferred copy that discards any loaded data. + /// `ByRef` entries keep their offset/size but get an empty `OnceCell`. + /// `ByVal` entries cannot be converted back to a reference, so this returns `None`. + #[inline(always)] + fn clone_as_ref(&self) -> Option { + match self { + LazyObject::ByRef { offset, size, .. } => { + Some(LazyObject::ByRef { + offset: *offset, + size: *size, + loaded: OnceCell::new(), + }) + } + LazyObject::ByVal(_) => None, + } + } + #[inline(always)] pub fn by_value(value: T) -> Self { LazyObject::ByVal(value) @@ -569,6 +606,19 @@ impl LazyValue { self.0.take_or_load(load) } + /// Returns a cheap copy with the value reset to its unloaded `ByRef` state. + /// Loaded data is discarded. `ByVal` entries are cloned as-is (no offset to refer to). + #[inline(always)] + fn shallow_clone(&self) -> Self { + match self.0.clone_as_ref() { + Some(lazy) => Self(lazy), + None => match &self.0 { + LazyObject::ByVal(v) => Self(LazyObject::ByVal(v.clone())), + _ => unreachable!(), + }, + } + } + /// Reads the value without populating the OnceCell. /// Returns the already-loaded value if present, otherwise reads from memory /// into a fresh buffer without storing it in the node. @@ -591,6 +641,28 @@ impl LazyValue { #[derive(Debug)] struct LazyKey(LazyObject); +impl LazyKey { + /// Returns a clone that preserves loaded keys (needed for search). + /// `ByRef` entries that haven't been loaded yet keep their deferred state. + #[inline(always)] + fn clone_with_key(&self) -> Self { + match &self.0 { + LazyObject::ByVal(v) => Self(LazyObject::ByVal(v.clone())), + LazyObject::ByRef { offset, size, loaded } => { + let new_loaded = OnceCell::new(); + if let Some(v) = loaded.get() { + let _ = new_loaded.set(v.clone()); + } + Self(LazyObject::ByRef { + offset: *offset, + size: *size, + loaded: new_loaded, + }) + } + } + } +} + impl LazyKey { #[inline(always)] pub fn by_value(value: K) -> Self { diff --git a/src/btreemap/node_cache.rs b/src/btreemap/node_cache.rs index 4777bebd..c1164b2c 100644 --- a/src/btreemap/node_cache.rs +++ b/src/btreemap/node_cache.rs @@ -151,6 +151,27 @@ impl NodeCache { (addr.get() / self.page_size as u64) as usize % self.slots.len() } + /// Returns a structural clone of the cached node without removing it. + /// Keys are cloned, values stay unloaded. The cache slot is not modified. + pub(super) fn peek(&mut self, addr: Address) -> Option> { + if !self.is_enabled() || addr == NULL { + return None; + } + let idx = self.slot_index(addr); + let slot = &self.slots[idx]; + if slot.address == addr { + self.metrics.observe_hit(); + slot.node.as_ref().map(|n| n.structural_clone()) + } else { + if slot.node.is_none() { + self.metrics.observe_cold_miss(); + } else { + self.metrics.observe_collision_miss(); + } + None + } + } + pub(super) fn take(&mut self, addr: Address) -> Option> { if !self.is_enabled() || addr == NULL { return None;