From 9b8a787b4eb74fcf3a395f40249365896213efca Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 13:19:31 +0200 Subject: [PATCH 01/19] add bench_case_bounded --- benchmarks/btreemap/src/main.rs | 276 ++++++++++++------------ benchmarks/compare/canbench_results.yml | 81 +------ benchmarks/compare/src/main.rs | 55 ++++- benchmarks/src/common.rs | 6 +- src/storable.rs | 63 ++++-- 5 files changed, 250 insertions(+), 231 deletions(-) diff --git a/benchmarks/btreemap/src/main.rs b/benchmarks/btreemap/src/main.rs index 6c348ca2..f3e24835 100644 --- a/benchmarks/btreemap/src/main.rs +++ b/benchmarks/btreemap/src/main.rs @@ -2,7 +2,7 @@ use benchmarks::common::Random; use canbench_rs::{bench, bench_fn, BenchResult}; use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; use ic_stable_structures::{ - storable::{Blob, FixedVec}, + storable::{Blob, UnboundedVec}, BTreeMap, DefaultMemoryImpl, Memory, Storable, }; use std::ops::Bound; @@ -20,15 +20,15 @@ type Blob512 = Blob<512>; type Blob1024 = Blob<1024>; // Unbounded types. -type FixedVec4 = FixedVec<4>; -type FixedVec8 = FixedVec<8>; -type FixedVec16 = FixedVec<16>; -type FixedVec32 = FixedVec<32>; -type FixedVec64 = FixedVec<64>; -type FixedVec128 = FixedVec<128>; -type FixedVec256 = FixedVec<256>; -type FixedVec512 = FixedVec<512>; -type FixedVec1024 = FixedVec<1024>; +type UnboundedVec4 = UnboundedVec<4>; +type UnboundedVec8 = UnboundedVec<8>; +type UnboundedVec16 = UnboundedVec<16>; +type UnboundedVec32 = UnboundedVec<32>; +type UnboundedVec64 = UnboundedVec<64>; +type UnboundedVec128 = UnboundedVec<128>; +type UnboundedVec256 = UnboundedVec<256>; +type UnboundedVec512 = UnboundedVec<512>; +type UnboundedVec1024 = UnboundedVec<1024>; #[allow(non_upper_case_globals)] const KiB: usize = 1024; @@ -92,40 +92,40 @@ bench_tests! { btreemap_v2_insert_blob_32_1024, insert_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_insert_vec_4_128, insert_helper_v2, FixedVec4, FixedVec128; - btreemap_v2_insert_vec_8_128, insert_helper_v2, FixedVec8, FixedVec128; - btreemap_v2_insert_vec_16_128, insert_helper_v2, FixedVec16, FixedVec128; - btreemap_v2_insert_vec_32_128, insert_helper_v2, FixedVec32, FixedVec128; - btreemap_v2_insert_vec_64_128, insert_helper_v2, FixedVec64, FixedVec128; - btreemap_v2_insert_vec_128_128, insert_helper_v2, FixedVec128, FixedVec128; - btreemap_v2_insert_vec_256_128, insert_helper_v2, FixedVec256, FixedVec128; - btreemap_v2_insert_vec_512_128, insert_helper_v2, FixedVec512, FixedVec128; - btreemap_v2_insert_vec_1024_128, insert_helper_v2, FixedVec1024, FixedVec128; + btreemap_v2_insert_vec_4_128, insert_helper_v2, UnboundedVec4, UnboundedVec128; + btreemap_v2_insert_vec_8_128, insert_helper_v2, UnboundedVec8, UnboundedVec128; + btreemap_v2_insert_vec_16_128, insert_helper_v2, UnboundedVec16, UnboundedVec128; + btreemap_v2_insert_vec_32_128, insert_helper_v2, UnboundedVec32, UnboundedVec128; + btreemap_v2_insert_vec_64_128, insert_helper_v2, UnboundedVec64, UnboundedVec128; + btreemap_v2_insert_vec_128_128, insert_helper_v2, UnboundedVec128, UnboundedVec128; + btreemap_v2_insert_vec_256_128, insert_helper_v2, UnboundedVec256, UnboundedVec128; + btreemap_v2_insert_vec_512_128, insert_helper_v2, UnboundedVec512, UnboundedVec128; + btreemap_v2_insert_vec_1024_128, insert_helper_v2, UnboundedVec1024, UnboundedVec128; // vec 32 x V - btreemap_v2_insert_vec_32_4, insert_helper_v2, FixedVec32, FixedVec4; - btreemap_v2_insert_vec_32_8, insert_helper_v2, FixedVec32, FixedVec8; - btreemap_v2_insert_vec_32_16, insert_helper_v2, FixedVec32, FixedVec16; - btreemap_v2_insert_vec_32_32, insert_helper_v2, FixedVec32, FixedVec32; - btreemap_v2_insert_vec_32_64, insert_helper_v2, FixedVec32, FixedVec64; - //btreemap_v2_insert_vec_32_128, insert_helper_v2, FixedVec32, FixedVec128; // Skip repeated. - btreemap_v2_insert_vec_32_256, insert_helper_v2, FixedVec32, FixedVec256; - btreemap_v2_insert_vec_32_512, insert_helper_v2, FixedVec32, FixedVec512; - btreemap_v2_insert_vec_32_1024, insert_helper_v2, FixedVec32, FixedVec1024; + btreemap_v2_insert_vec_32_4, insert_helper_v2, UnboundedVec32, UnboundedVec4; + btreemap_v2_insert_vec_32_8, insert_helper_v2, UnboundedVec32, UnboundedVec8; + btreemap_v2_insert_vec_32_16, insert_helper_v2, UnboundedVec32, UnboundedVec16; + btreemap_v2_insert_vec_32_32, insert_helper_v2, UnboundedVec32, UnboundedVec32; + btreemap_v2_insert_vec_32_64, insert_helper_v2, UnboundedVec32, UnboundedVec64; + //btreemap_v2_insert_vec_32_128, insert_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. + btreemap_v2_insert_vec_32_256, insert_helper_v2, UnboundedVec32, UnboundedVec256; + btreemap_v2_insert_vec_32_512, insert_helper_v2, UnboundedVec32, UnboundedVec512; + btreemap_v2_insert_vec_32_1024, insert_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 btreemap_v2_insert_u64_u64, insert_helper_v2, u64, u64; btreemap_v2_insert_u64_blob8, insert_helper_v2, u64, Blob8; btreemap_v2_insert_blob8_u64, insert_helper_v2, Blob8, u64; - btreemap_v2_insert_u64_vec8, insert_helper_v2, u64, FixedVec8; - btreemap_v2_insert_vec8_u64, insert_helper_v2, FixedVec8, u64; + btreemap_v2_insert_u64_vec8, insert_helper_v2, u64, UnboundedVec8; + btreemap_v2_insert_vec8_u64, insert_helper_v2, UnboundedVec8, u64; // memory manager u64 / blob512 / vec512 btreemap_v2_mem_manager_insert_u64_u64, insert_helper_v2_mem_manager, u64, u64; btreemap_v2_mem_manager_insert_u64_blob512, insert_helper_v2_mem_manager, u64, Blob512; btreemap_v2_mem_manager_insert_blob512_u64, insert_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_insert_u64_vec512, insert_helper_v2_mem_manager, u64, FixedVec512; - btreemap_v2_mem_manager_insert_vec512_u64, insert_helper_v2_mem_manager, FixedVec512, u64; + btreemap_v2_mem_manager_insert_u64_vec512, insert_helper_v2_mem_manager, u64, UnboundedVec512; + btreemap_v2_mem_manager_insert_vec512_u64, insert_helper_v2_mem_manager, UnboundedVec512, u64; } fn insert_helper_v2() -> BenchResult { @@ -192,40 +192,40 @@ bench_tests! { btreemap_v2_remove_blob_32_1024, remove_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_remove_vec_4_128, remove_helper_v2, FixedVec4, FixedVec128; - btreemap_v2_remove_vec_8_128, remove_helper_v2, FixedVec8, FixedVec128; - btreemap_v2_remove_vec_16_128, remove_helper_v2, FixedVec16, FixedVec128; - btreemap_v2_remove_vec_32_128, remove_helper_v2, FixedVec32, FixedVec128; - btreemap_v2_remove_vec_64_128, remove_helper_v2, FixedVec64, FixedVec128; - btreemap_v2_remove_vec_128_128, remove_helper_v2, FixedVec128, FixedVec128; - btreemap_v2_remove_vec_256_128, remove_helper_v2, FixedVec256, FixedVec128; - btreemap_v2_remove_vec_512_128, remove_helper_v2, FixedVec512, FixedVec128; - btreemap_v2_remove_vec_1024_128, remove_helper_v2, FixedVec1024, FixedVec128; + btreemap_v2_remove_vec_4_128, remove_helper_v2, UnboundedVec4, UnboundedVec128; + btreemap_v2_remove_vec_8_128, remove_helper_v2, UnboundedVec8, UnboundedVec128; + btreemap_v2_remove_vec_16_128, remove_helper_v2, UnboundedVec16, UnboundedVec128; + btreemap_v2_remove_vec_32_128, remove_helper_v2, UnboundedVec32, UnboundedVec128; + btreemap_v2_remove_vec_64_128, remove_helper_v2, UnboundedVec64, UnboundedVec128; + btreemap_v2_remove_vec_128_128, remove_helper_v2, UnboundedVec128, UnboundedVec128; + btreemap_v2_remove_vec_256_128, remove_helper_v2, UnboundedVec256, UnboundedVec128; + btreemap_v2_remove_vec_512_128, remove_helper_v2, UnboundedVec512, UnboundedVec128; + btreemap_v2_remove_vec_1024_128, remove_helper_v2, UnboundedVec1024, UnboundedVec128; // vec 32 x V - btreemap_v2_remove_vec_32_4, remove_helper_v2, FixedVec32, FixedVec4; - btreemap_v2_remove_vec_32_8, remove_helper_v2, FixedVec32, FixedVec8; - btreemap_v2_remove_vec_32_16, remove_helper_v2, FixedVec32, FixedVec16; - btreemap_v2_remove_vec_32_32, remove_helper_v2, FixedVec32, FixedVec32; - btreemap_v2_remove_vec_32_64, remove_helper_v2, FixedVec32, FixedVec64; - //btreemap_v2_remove_vec_32_128, remove_helper_v2, FixedVec32, FixedVec128; // Skip repeated. - btreemap_v2_remove_vec_32_256, remove_helper_v2, FixedVec32, FixedVec256; - btreemap_v2_remove_vec_32_512, remove_helper_v2, FixedVec32, FixedVec512; - btreemap_v2_remove_vec_32_1024, remove_helper_v2, FixedVec32, FixedVec1024; + btreemap_v2_remove_vec_32_4, remove_helper_v2, UnboundedVec32, UnboundedVec4; + btreemap_v2_remove_vec_32_8, remove_helper_v2, UnboundedVec32, UnboundedVec8; + btreemap_v2_remove_vec_32_16, remove_helper_v2, UnboundedVec32, UnboundedVec16; + btreemap_v2_remove_vec_32_32, remove_helper_v2, UnboundedVec32, UnboundedVec32; + btreemap_v2_remove_vec_32_64, remove_helper_v2, UnboundedVec32, UnboundedVec64; + //btreemap_v2_remove_vec_32_128, remove_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. + btreemap_v2_remove_vec_32_256, remove_helper_v2, UnboundedVec32, UnboundedVec256; + btreemap_v2_remove_vec_32_512, remove_helper_v2, UnboundedVec32, UnboundedVec512; + btreemap_v2_remove_vec_32_1024, remove_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 btreemap_v2_remove_u64_u64, remove_helper_v2, u64, u64; btreemap_v2_remove_u64_blob8, remove_helper_v2, u64, Blob8; btreemap_v2_remove_blob8_u64, remove_helper_v2, Blob8, u64; - btreemap_v2_remove_u64_vec8, remove_helper_v2, u64, FixedVec8; - btreemap_v2_remove_vec8_u64, remove_helper_v2, FixedVec8, u64; + btreemap_v2_remove_u64_vec8, remove_helper_v2, u64, UnboundedVec8; + btreemap_v2_remove_vec8_u64, remove_helper_v2, UnboundedVec8, u64; // memory manager u64 / blob512 / vec512 btreemap_v2_mem_manager_remove_u64_u64, remove_helper_v2_mem_manager, u64, u64; btreemap_v2_mem_manager_remove_u64_blob512, remove_helper_v2_mem_manager, u64, Blob512; btreemap_v2_mem_manager_remove_blob512_u64, remove_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_remove_u64_vec512, remove_helper_v2_mem_manager, u64, FixedVec512; - btreemap_v2_mem_manager_remove_vec512_u64, remove_helper_v2_mem_manager, FixedVec512, u64; + btreemap_v2_mem_manager_remove_u64_vec512, remove_helper_v2_mem_manager, u64, UnboundedVec512; + btreemap_v2_mem_manager_remove_vec512_u64, remove_helper_v2_mem_manager, UnboundedVec512, u64; } fn remove_helper_v2() -> BenchResult { @@ -299,40 +299,40 @@ bench_tests! { btreemap_v2_get_blob_32_1024, get_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_get_vec_4_128, get_helper_v2, FixedVec4, FixedVec128; - btreemap_v2_get_vec_8_128, get_helper_v2, FixedVec8, FixedVec128; - btreemap_v2_get_vec_16_128, get_helper_v2, FixedVec16, FixedVec128; - btreemap_v2_get_vec_32_128, get_helper_v2, FixedVec32, FixedVec128; - btreemap_v2_get_vec_64_128, get_helper_v2, FixedVec64, FixedVec128; - btreemap_v2_get_vec_128_128, get_helper_v2, FixedVec128, FixedVec128; - btreemap_v2_get_vec_256_128, get_helper_v2, FixedVec256, FixedVec128; - btreemap_v2_get_vec_512_128, get_helper_v2, FixedVec512, FixedVec128; - btreemap_v2_get_vec_1024_128, get_helper_v2, FixedVec1024, FixedVec128; + btreemap_v2_get_vec_4_128, get_helper_v2, UnboundedVec4, UnboundedVec128; + btreemap_v2_get_vec_8_128, get_helper_v2, UnboundedVec8, UnboundedVec128; + btreemap_v2_get_vec_16_128, get_helper_v2, UnboundedVec16, UnboundedVec128; + btreemap_v2_get_vec_32_128, get_helper_v2, UnboundedVec32, UnboundedVec128; + btreemap_v2_get_vec_64_128, get_helper_v2, UnboundedVec64, UnboundedVec128; + btreemap_v2_get_vec_128_128, get_helper_v2, UnboundedVec128, UnboundedVec128; + btreemap_v2_get_vec_256_128, get_helper_v2, UnboundedVec256, UnboundedVec128; + btreemap_v2_get_vec_512_128, get_helper_v2, UnboundedVec512, UnboundedVec128; + btreemap_v2_get_vec_1024_128, get_helper_v2, UnboundedVec1024, UnboundedVec128; // vec 32 x V - btreemap_v2_get_vec_32_4, get_helper_v2, FixedVec32, FixedVec4; - btreemap_v2_get_vec_32_8, get_helper_v2, FixedVec32, FixedVec8; - btreemap_v2_get_vec_32_16, get_helper_v2, FixedVec32, FixedVec16; - btreemap_v2_get_vec_32_32, get_helper_v2, FixedVec32, FixedVec32; - btreemap_v2_get_vec_32_64, get_helper_v2, FixedVec32, FixedVec64; - //btreemap_v2_get_vec_32_128, get_helper_v2, FixedVec32, FixedVec128; // Skip repeated. - btreemap_v2_get_vec_32_256, get_helper_v2, FixedVec32, FixedVec256; - btreemap_v2_get_vec_32_512, get_helper_v2, FixedVec32, FixedVec512; - btreemap_v2_get_vec_32_1024, get_helper_v2, FixedVec32, FixedVec1024; + btreemap_v2_get_vec_32_4, get_helper_v2, UnboundedVec32, UnboundedVec4; + btreemap_v2_get_vec_32_8, get_helper_v2, UnboundedVec32, UnboundedVec8; + btreemap_v2_get_vec_32_16, get_helper_v2, UnboundedVec32, UnboundedVec16; + btreemap_v2_get_vec_32_32, get_helper_v2, UnboundedVec32, UnboundedVec32; + btreemap_v2_get_vec_32_64, get_helper_v2, UnboundedVec32, UnboundedVec64; + //btreemap_v2_get_vec_32_128, get_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. + btreemap_v2_get_vec_32_256, get_helper_v2, UnboundedVec32, UnboundedVec256; + btreemap_v2_get_vec_32_512, get_helper_v2, UnboundedVec32, UnboundedVec512; + btreemap_v2_get_vec_32_1024, get_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 btreemap_v2_get_u64_u64, get_helper_v2, u64, u64; btreemap_v2_get_u64_blob8, get_helper_v2, u64, Blob8; btreemap_v2_get_blob8_u64, get_helper_v2, Blob8, u64; - btreemap_v2_get_u64_vec8, get_helper_v2, u64, FixedVec8; - btreemap_v2_get_vec8_u64, get_helper_v2, FixedVec8, u64; + btreemap_v2_get_u64_vec8, get_helper_v2, u64, UnboundedVec8; + btreemap_v2_get_vec8_u64, get_helper_v2, UnboundedVec8, u64; // memory manager u64 / blob512 / vec512 btreemap_v2_mem_manager_get_u64_u64, get_helper_v2_mem_manager, u64, u64; btreemap_v2_mem_manager_get_u64_blob512, get_helper_v2_mem_manager, u64, Blob512; btreemap_v2_mem_manager_get_blob512_u64, get_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_get_u64_vec512, get_helper_v2_mem_manager, u64, FixedVec512; - btreemap_v2_mem_manager_get_vec512_u64, get_helper_v2_mem_manager, FixedVec512, u64; + btreemap_v2_mem_manager_get_u64_vec512, get_helper_v2_mem_manager, u64, UnboundedVec512; + btreemap_v2_mem_manager_get_vec512_u64, get_helper_v2_mem_manager, UnboundedVec512, u64; } fn get_helper_v2() -> BenchResult { @@ -406,40 +406,40 @@ bench_tests! { btreemap_v2_contains_blob_32_1024, contains_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_contains_vec_4_128, contains_helper_v2, FixedVec4, FixedVec128; - btreemap_v2_contains_vec_8_128, contains_helper_v2, FixedVec8, FixedVec128; - btreemap_v2_contains_vec_16_128, contains_helper_v2, FixedVec16, FixedVec128; - btreemap_v2_contains_vec_32_128, contains_helper_v2, FixedVec32, FixedVec128; - btreemap_v2_contains_vec_64_128, contains_helper_v2, FixedVec64, FixedVec128; - btreemap_v2_contains_vec_128_128, contains_helper_v2, FixedVec128, FixedVec128; - btreemap_v2_contains_vec_256_128, contains_helper_v2, FixedVec256, FixedVec128; - btreemap_v2_contains_vec_512_128, contains_helper_v2, FixedVec512, FixedVec128; - btreemap_v2_contains_vec_1024_128, contains_helper_v2, FixedVec1024, FixedVec128; + btreemap_v2_contains_vec_4_128, contains_helper_v2, UnboundedVec4, UnboundedVec128; + btreemap_v2_contains_vec_8_128, contains_helper_v2, UnboundedVec8, UnboundedVec128; + btreemap_v2_contains_vec_16_128, contains_helper_v2, UnboundedVec16, UnboundedVec128; + btreemap_v2_contains_vec_32_128, contains_helper_v2, UnboundedVec32, UnboundedVec128; + btreemap_v2_contains_vec_64_128, contains_helper_v2, UnboundedVec64, UnboundedVec128; + btreemap_v2_contains_vec_128_128, contains_helper_v2, UnboundedVec128, UnboundedVec128; + btreemap_v2_contains_vec_256_128, contains_helper_v2, UnboundedVec256, UnboundedVec128; + btreemap_v2_contains_vec_512_128, contains_helper_v2, UnboundedVec512, UnboundedVec128; + btreemap_v2_contains_vec_1024_128, contains_helper_v2, UnboundedVec1024, UnboundedVec128; // vec 32 x V - btreemap_v2_contains_vec_32_4, contains_helper_v2, FixedVec32, FixedVec4; - btreemap_v2_contains_vec_32_8, contains_helper_v2, FixedVec32, FixedVec8; - btreemap_v2_contains_vec_32_16, contains_helper_v2, FixedVec32, FixedVec16; - btreemap_v2_contains_vec_32_32, contains_helper_v2, FixedVec32, FixedVec32; - btreemap_v2_contains_vec_32_64, contains_helper_v2, FixedVec32, FixedVec64; - //btreemap_v2_contains_vec_32_128, contains_helper_v2, FixedVec32, FixedVec128; // Skip repeated. - btreemap_v2_contains_vec_32_256, contains_helper_v2, FixedVec32, FixedVec256; - btreemap_v2_contains_vec_32_512, contains_helper_v2, FixedVec32, FixedVec512; - btreemap_v2_contains_vec_32_1024, contains_helper_v2, FixedVec32, FixedVec1024; + btreemap_v2_contains_vec_32_4, contains_helper_v2, UnboundedVec32, UnboundedVec4; + btreemap_v2_contains_vec_32_8, contains_helper_v2, UnboundedVec32, UnboundedVec8; + btreemap_v2_contains_vec_32_16, contains_helper_v2, UnboundedVec32, UnboundedVec16; + btreemap_v2_contains_vec_32_32, contains_helper_v2, UnboundedVec32, UnboundedVec32; + btreemap_v2_contains_vec_32_64, contains_helper_v2, UnboundedVec32, UnboundedVec64; + //btreemap_v2_contains_vec_32_128, contains_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. + btreemap_v2_contains_vec_32_256, contains_helper_v2, UnboundedVec32, UnboundedVec256; + btreemap_v2_contains_vec_32_512, contains_helper_v2, UnboundedVec32, UnboundedVec512; + btreemap_v2_contains_vec_32_1024, contains_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 btreemap_v2_contains_u64_u64, contains_helper_v2, u64, u64; btreemap_v2_contains_u64_blob8, contains_helper_v2, u64, Blob8; btreemap_v2_contains_blob8_u64, contains_helper_v2, Blob8, u64; - btreemap_v2_contains_u64_vec8, contains_helper_v2, u64, FixedVec8; - btreemap_v2_contains_vec8_u64, contains_helper_v2, FixedVec8, u64; + btreemap_v2_contains_u64_vec8, contains_helper_v2, u64, UnboundedVec8; + btreemap_v2_contains_vec8_u64, contains_helper_v2, UnboundedVec8, u64; // memory manager u64 / blob512 / vec512 btreemap_v2_mem_manager_contains_u64_u64, contains_helper_v2_mem_manager, u64, u64; btreemap_v2_mem_manager_contains_u64_blob512, contains_helper_v2_mem_manager, u64, Blob512; btreemap_v2_mem_manager_contains_blob512_u64, contains_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_contains_u64_vec512, contains_helper_v2_mem_manager, u64, FixedVec512; - btreemap_v2_mem_manager_contains_vec512_u64, contains_helper_v2_mem_manager, FixedVec512, u64; + btreemap_v2_mem_manager_contains_u64_vec512, contains_helper_v2_mem_manager, u64, UnboundedVec512; + btreemap_v2_mem_manager_contains_vec512_u64, contains_helper_v2_mem_manager, UnboundedVec512, u64; } fn contains_helper_v2() -> BenchResult { @@ -535,33 +535,33 @@ bench_tests! { btreemap_v2_pop_first_blob_32_1024, pop_first_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_pop_first_vec_4_128, pop_first_helper_v2, FixedVec4, FixedVec128; - btreemap_v2_pop_first_vec_8_128, pop_first_helper_v2, FixedVec8, FixedVec128; - btreemap_v2_pop_first_vec_16_128, pop_first_helper_v2, FixedVec16, FixedVec128; - btreemap_v2_pop_first_vec_32_128, pop_first_helper_v2, FixedVec32, FixedVec128; - btreemap_v2_pop_first_vec_64_128, pop_first_helper_v2, FixedVec64, FixedVec128; - btreemap_v2_pop_first_vec_128_128, pop_first_helper_v2, FixedVec128, FixedVec128; - btreemap_v2_pop_first_vec_256_128, pop_first_helper_v2, FixedVec256, FixedVec128; - btreemap_v2_pop_first_vec_512_128, pop_first_helper_v2, FixedVec512, FixedVec128; - btreemap_v2_pop_first_vec_1024_128, pop_first_helper_v2, FixedVec1024, FixedVec128; + btreemap_v2_pop_first_vec_4_128, pop_first_helper_v2, UnboundedVec4, UnboundedVec128; + btreemap_v2_pop_first_vec_8_128, pop_first_helper_v2, UnboundedVec8, UnboundedVec128; + btreemap_v2_pop_first_vec_16_128, pop_first_helper_v2, UnboundedVec16, UnboundedVec128; + btreemap_v2_pop_first_vec_32_128, pop_first_helper_v2, UnboundedVec32, UnboundedVec128; + btreemap_v2_pop_first_vec_64_128, pop_first_helper_v2, UnboundedVec64, UnboundedVec128; + btreemap_v2_pop_first_vec_128_128, pop_first_helper_v2, UnboundedVec128, UnboundedVec128; + btreemap_v2_pop_first_vec_256_128, pop_first_helper_v2, UnboundedVec256, UnboundedVec128; + btreemap_v2_pop_first_vec_512_128, pop_first_helper_v2, UnboundedVec512, UnboundedVec128; + btreemap_v2_pop_first_vec_1024_128, pop_first_helper_v2, UnboundedVec1024, UnboundedVec128; // vec 32 x V - btreemap_v2_pop_first_vec_32_4, pop_first_helper_v2, FixedVec32, FixedVec4; - btreemap_v2_pop_first_vec_32_8, pop_first_helper_v2, FixedVec32, FixedVec8; - btreemap_v2_pop_first_vec_32_16, pop_first_helper_v2, FixedVec32, FixedVec16; - btreemap_v2_pop_first_vec_32_32, pop_first_helper_v2, FixedVec32, FixedVec32; - btreemap_v2_pop_first_vec_32_64, pop_first_helper_v2, FixedVec32, FixedVec64; - //btreemap_v2_pop_first_vec_32_128, pop_first_helper_v2, FixedVec32, FixedVec128; // Skip repeated. - btreemap_v2_pop_first_vec_32_256, pop_first_helper_v2, FixedVec32, FixedVec256; - btreemap_v2_pop_first_vec_32_512, pop_first_helper_v2, FixedVec32, FixedVec512; - btreemap_v2_pop_first_vec_32_1024, pop_first_helper_v2, FixedVec32, FixedVec1024; + btreemap_v2_pop_first_vec_32_4, pop_first_helper_v2, UnboundedVec32, UnboundedVec4; + btreemap_v2_pop_first_vec_32_8, pop_first_helper_v2, UnboundedVec32, UnboundedVec8; + btreemap_v2_pop_first_vec_32_16, pop_first_helper_v2, UnboundedVec32, UnboundedVec16; + btreemap_v2_pop_first_vec_32_32, pop_first_helper_v2, UnboundedVec32, UnboundedVec32; + btreemap_v2_pop_first_vec_32_64, pop_first_helper_v2, UnboundedVec32, UnboundedVec64; + //btreemap_v2_pop_first_vec_32_128, pop_first_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. + btreemap_v2_pop_first_vec_32_256, pop_first_helper_v2, UnboundedVec32, UnboundedVec256; + btreemap_v2_pop_first_vec_32_512, pop_first_helper_v2, UnboundedVec32, UnboundedVec512; + btreemap_v2_pop_first_vec_32_1024, pop_first_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 btreemap_v2_pop_first_u64_u64, pop_first_helper_v2, u64, u64; btreemap_v2_pop_first_u64_blob8, pop_first_helper_v2, u64, Blob8; btreemap_v2_pop_first_blob8_u64, pop_first_helper_v2, Blob8, u64; - btreemap_v2_pop_first_u64_vec8, pop_first_helper_v2, u64, FixedVec8; - btreemap_v2_pop_first_vec8_u64, pop_first_helper_v2, FixedVec8, u64; + btreemap_v2_pop_first_u64_vec8, pop_first_helper_v2, u64, UnboundedVec8; + btreemap_v2_pop_first_vec8_u64, pop_first_helper_v2, UnboundedVec8, u64; } // Last @@ -589,33 +589,33 @@ bench_tests! { btreemap_v2_pop_last_blob_32_1024, pop_last_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_pop_last_vec_4_128, pop_last_helper_v2, FixedVec4, FixedVec128; - btreemap_v2_pop_last_vec_8_128, pop_last_helper_v2, FixedVec8, FixedVec128; - btreemap_v2_pop_last_vec_16_128, pop_last_helper_v2, FixedVec16, FixedVec128; - btreemap_v2_pop_last_vec_32_128, pop_last_helper_v2, FixedVec32, FixedVec128; - btreemap_v2_pop_last_vec_64_128, pop_last_helper_v2, FixedVec64, FixedVec128; - btreemap_v2_pop_last_vec_128_128, pop_last_helper_v2, FixedVec128, FixedVec128; - btreemap_v2_pop_last_vec_256_128, pop_last_helper_v2, FixedVec256, FixedVec128; - btreemap_v2_pop_last_vec_512_128, pop_last_helper_v2, FixedVec512, FixedVec128; - btreemap_v2_pop_last_vec_1024_128, pop_last_helper_v2, FixedVec1024, FixedVec128; + btreemap_v2_pop_last_vec_4_128, pop_last_helper_v2, UnboundedVec4, UnboundedVec128; + btreemap_v2_pop_last_vec_8_128, pop_last_helper_v2, UnboundedVec8, UnboundedVec128; + btreemap_v2_pop_last_vec_16_128, pop_last_helper_v2, UnboundedVec16, UnboundedVec128; + btreemap_v2_pop_last_vec_32_128, pop_last_helper_v2, UnboundedVec32, UnboundedVec128; + btreemap_v2_pop_last_vec_64_128, pop_last_helper_v2, UnboundedVec64, UnboundedVec128; + btreemap_v2_pop_last_vec_128_128, pop_last_helper_v2, UnboundedVec128, UnboundedVec128; + btreemap_v2_pop_last_vec_256_128, pop_last_helper_v2, UnboundedVec256, UnboundedVec128; + btreemap_v2_pop_last_vec_512_128, pop_last_helper_v2, UnboundedVec512, UnboundedVec128; + btreemap_v2_pop_last_vec_1024_128, pop_last_helper_v2, UnboundedVec1024, UnboundedVec128; // vec 32 x V - btreemap_v2_pop_last_vec_32_4, pop_last_helper_v2, FixedVec32, FixedVec4; - btreemap_v2_pop_last_vec_32_8, pop_last_helper_v2, FixedVec32, FixedVec8; - btreemap_v2_pop_last_vec_32_16, pop_last_helper_v2, FixedVec32, FixedVec16; - btreemap_v2_pop_last_vec_32_32, pop_last_helper_v2, FixedVec32, FixedVec32; - btreemap_v2_pop_last_vec_32_64, pop_last_helper_v2, FixedVec32, FixedVec64; - //btreemap_v2_pop_last_vec_32_128, pop_last_helper_v2, FixedVec32, FixedVec128; // Skip repeated. - btreemap_v2_pop_last_vec_32_256, pop_last_helper_v2, FixedVec32, FixedVec256; - btreemap_v2_pop_last_vec_32_512, pop_last_helper_v2, FixedVec32, FixedVec512; - btreemap_v2_pop_last_vec_32_1024, pop_last_helper_v2, FixedVec32, FixedVec1024; + btreemap_v2_pop_last_vec_32_4, pop_last_helper_v2, UnboundedVec32, UnboundedVec4; + btreemap_v2_pop_last_vec_32_8, pop_last_helper_v2, UnboundedVec32, UnboundedVec8; + btreemap_v2_pop_last_vec_32_16, pop_last_helper_v2, UnboundedVec32, UnboundedVec16; + btreemap_v2_pop_last_vec_32_32, pop_last_helper_v2, UnboundedVec32, UnboundedVec32; + btreemap_v2_pop_last_vec_32_64, pop_last_helper_v2, UnboundedVec32, UnboundedVec64; + //btreemap_v2_pop_last_vec_32_128, pop_last_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. + btreemap_v2_pop_last_vec_32_256, pop_last_helper_v2, UnboundedVec32, UnboundedVec256; + btreemap_v2_pop_last_vec_32_512, pop_last_helper_v2, UnboundedVec32, UnboundedVec512; + btreemap_v2_pop_last_vec_32_1024, pop_last_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 btreemap_v2_pop_last_u64_u64, pop_last_helper_v2, u64, u64; btreemap_v2_pop_last_u64_blob8, pop_last_helper_v2, u64, Blob8; btreemap_v2_pop_last_blob8_u64, pop_last_helper_v2, Blob8, u64; - btreemap_v2_pop_last_u64_vec8, pop_last_helper_v2, u64, FixedVec8; - btreemap_v2_pop_last_vec8_u64, pop_last_helper_v2, FixedVec8, u64; + btreemap_v2_pop_last_u64_vec8, pop_last_helper_v2, u64, UnboundedVec8; + btreemap_v2_pop_last_vec8_u64, pop_last_helper_v2, UnboundedVec8, u64; } fn pop_first_helper_v2() -> BenchResult { diff --git a/benchmarks/compare/canbench_results.yml b/benchmarks/compare/canbench_results.yml index 0fc9dec8..6f3b8870 100644 --- a/benchmarks/compare/canbench_results.yml +++ b/benchmarks/compare/canbench_results.yml @@ -1,86 +1,23 @@ benches: - read_chunks_btreemap_1: + write_chunks_vec_1: total: calls: 1 - instructions: 1220197642 - heap_increase: 3233 + instructions: 1257794454 + heap_increase: 3202 stable_memory_increase: 1665 scopes: {} - read_chunks_btreemap_1k: + write_chunks_vec_1k: total: calls: 1 - instructions: 5418812624 - heap_increase: 1604 + instructions: 1272107508 + heap_increase: 3200 stable_memory_increase: 1665 scopes: {} - read_chunks_btreemap_1m: + write_chunks_vec_1m: total: calls: 1 - instructions: 133684080756 - heap_increase: 1892 - stable_memory_increase: 3201 - scopes: {} - read_chunks_stable_1: - total: - calls: 1 - instructions: 812767514 - heap_increase: 1601 - stable_memory_increase: 1665 - scopes: {} - read_chunks_stable_1k: - total: - calls: 1 - instructions: 525926853 - heap_increase: 1600 - stable_memory_increase: 1665 - scopes: {} - read_chunks_stable_1m: - total: - calls: 1 - instructions: 1307625987 - heap_increase: 1892 - stable_memory_increase: 1665 - scopes: {} - write_chunks_btreemap_1: - total: - calls: 1 - instructions: 1070838059 - heap_increase: 3233 - stable_memory_increase: 1665 - scopes: {} - write_chunks_btreemap_1k: - total: - calls: 1 - instructions: 4918823602 - heap_increase: 1604 - stable_memory_increase: 1665 - scopes: {} - write_chunks_btreemap_1m: - total: - calls: 1 - instructions: 89917688426 - heap_increase: 1892 - stable_memory_increase: 3201 - scopes: {} - write_chunks_stable_1: - total: - calls: 1 - instructions: 418914609 - heap_increase: 1601 - stable_memory_increase: 1665 - scopes: {} - write_chunks_stable_1k: - total: - calls: 1 - instructions: 420017351 - heap_increase: 1600 - stable_memory_increase: 1665 - scopes: {} - write_chunks_stable_1m: - total: - calls: 1 - instructions: 1076987632 - heap_increase: 1892 + instructions: 3708430886 + heap_increase: 3784 stable_memory_increase: 1665 scopes: {} version: 0.1.15 diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index 4e62b4bd..d7df58c8 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -2,7 +2,8 @@ use canbench_rs::{bench, bench_fn}; use ic_cdk::api::stable::WASM_PAGE_SIZE_IN_BYTES; use ic_stable_structures::{ memory_manager::{MemoryId, MemoryManager}, - BTreeMap, DefaultMemoryImpl, Memory, + storable::BoundedVec, + BTreeMap, DefaultMemoryImpl, Memory, Vec as StableVec, }; const TOTAL_SIZE: usize = 100 * 1024 * 1024; // 100 MiB @@ -20,6 +21,10 @@ fn ensure_memory_size(memory: &impl Memory, size: usize) { } } +const fn chunk_size() -> usize { + TOTAL_SIZE / N +} + fn chunk_data(n: usize) -> Vec> { let chunk_size = TOTAL_SIZE / n; (0..n).map(|_| vec![37; chunk_size]).collect() @@ -76,6 +81,36 @@ fn read_chunks_btreemap(mem_id: u8, n: usize) { }); } +// StableVec benchmarks + +fn write_chunks_vec(mem_id: u8, n: usize) { + ic_cdk::println!("Chunk size: {}, chunks: {}", CHUNK_SIZE, n); + let vec: StableVec, _> = + StableVec::new(init_memory(mem_id)).expect("Vec::new failed"); + let chunks: Vec<_> = chunk_data(n) + .iter() + .map(|chunk| BoundedVec::from(chunk)) + .collect(); + + bench_fn(|| { + for chunk in chunks { + vec.push(&chunk).expect("Vec::push failed"); + } + }); +} + +fn read_chunks_vec(mem_id: u8, n: usize) { + write_chunks_vec::(mem_id, n); + let vec: StableVec, _> = + StableVec::init(init_memory(mem_id)).expect("Vec::init failed"); + + bench_fn(|| { + for i in 0..n as u64 { + let _ = vec.get(i); + } + }); +} + // Macro to define a single benchmark function macro_rules! bench_case { ($name:ident, $func:ident, $mem_id:expr, $n:expr) => { @@ -86,6 +121,16 @@ macro_rules! bench_case { }; } +macro_rules! bench_case_bounded { + ($name:ident, $func:ident, $mem_id:expr, $n:expr) => { + #[bench] + fn $name() { + const SIZE: usize = chunk_size::<$n>(); + $func::($mem_id, $n); + } + }; +} + // Stable Memory benchmarks bench_case!(write_chunks_stable_1, write_chunks_stable, 10, 1); bench_case!(write_chunks_stable_1k, write_chunks_stable, 11, K); @@ -102,4 +147,12 @@ bench_case!(read_chunks_btreemap_1, read_chunks_btreemap, 40, 1); bench_case!(read_chunks_btreemap_1k, read_chunks_btreemap, 41, K); bench_case!(read_chunks_btreemap_1m, read_chunks_btreemap, 42, M); +// StableVec benchmarks +bench_case_bounded!(write_chunks_vec_1, write_chunks_vec, 50, 1); +bench_case_bounded!(write_chunks_vec_1k, write_chunks_vec, 51, K); +bench_case_bounded!(write_chunks_vec_1m, write_chunks_vec, 52, M); +bench_case_bounded!(read_chunks_vec_1, read_chunks_vec, 60, 1); +bench_case_bounded!(read_chunks_vec_1k, read_chunks_vec, 61, K); +bench_case_bounded!(read_chunks_vec_1m, read_chunks_vec, 62, M); + fn main() {} diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index b7041181..d815a9b3 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -1,4 +1,4 @@ -use ic_stable_structures::storable::{Blob, FixedVec, Storable}; +use ic_stable_structures::storable::{Blob, Storable, UnboundedVec}; use tiny_rng::{Rand, Rng}; pub trait Random { @@ -18,14 +18,14 @@ impl Random for Blob { } } -impl Random for FixedVec { +impl Random for UnboundedVec { fn random(rng: &mut Rng) -> Self { let size = rng.rand_u32() % Self::max_size(); let mut buf = Vec::with_capacity(size as usize); for _ in 0..size { buf.push(rng.rand_u8()); } - FixedVec::from(&buf) + UnboundedVec::from(&buf) } } diff --git a/src/storable.rs b/src/storable.rs index 044ffa9a..9bb8fdd2 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -190,48 +190,77 @@ impl Storable for Blob { }; } -/// Byte‑vector for testing size N; otherwise just a Vec. +/// Unbounded vector of bytes filled with up to `N` bytes. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] -pub struct FixedVec(Vec); +pub struct UnboundedVec(Vec); -impl FixedVec { +impl UnboundedVec { pub fn max_size() -> u32 { N as u32 } pub fn from(slice: &[u8]) -> Self { - assert!( - slice.len() <= N, - "expected a slice with length <= {} bytes, but found {} bytes", - N, - slice.len() - ); - let mut vec = Vec::with_capacity(N); - vec.extend_from_slice(slice); - vec.resize(N, 0); - FixedVec(vec) + assert_eq!(slice.len(), N); + UnboundedVec(slice.to_vec()) } } -impl Default for FixedVec { +impl Default for UnboundedVec { fn default() -> Self { - FixedVec(vec![0; N]) + UnboundedVec(vec![0; N]) } } -impl Storable for FixedVec { +impl Storable for UnboundedVec { fn to_bytes(&self) -> Cow<[u8]> { Cow::Owned(self.0.clone()) } #[inline] fn from_bytes(bytes: Cow<[u8]>) -> Self { - FixedVec(bytes.into_owned()) + UnboundedVec(bytes.into_owned()) } const BOUND: Bound = Bound::Unbounded; } +/// Bounded vector of bytes filled with up to `N` bytes. +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] +pub struct BoundedVec(Vec); + +impl BoundedVec { + pub fn max_size() -> u32 { + N as u32 + } + + pub fn from(slice: &[u8]) -> Self { + assert_eq!(slice.len(), N); + BoundedVec(slice.to_vec()) + } +} + +impl Default for BoundedVec { + fn default() -> Self { + BoundedVec(vec![0; N]) + } +} + +impl Storable for BoundedVec { + fn to_bytes(&self) -> Cow<[u8]> { + Cow::Owned(self.0.clone()) + } + + #[inline] + fn from_bytes(bytes: Cow<[u8]>) -> Self { + BoundedVec(bytes.into_owned()) + } + + const BOUND: Bound = Bound::Bounded { + max_size: N as u32, + is_fixed_size: false, + }; +} + // NOTE: Below are a few implementations of `Storable` for common types. // Some of these implementations use `unwrap`, as opposed to returning a `Result` // with a possible error. The reason behind this decision is that these From e33b8c7ed0067334f6763f98a7d1a4712222a9a3 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 13:28:54 +0200 Subject: [PATCH 02/19] --persist --- benchmarks/compare/canbench_results.yml | 111 +++++++++++++++++++++++- benchmarks/compare/src/main.rs | 34 ++++---- 2 files changed, 126 insertions(+), 19 deletions(-) diff --git a/benchmarks/compare/canbench_results.yml b/benchmarks/compare/canbench_results.yml index 6f3b8870..5275e137 100644 --- a/benchmarks/compare/canbench_results.yml +++ b/benchmarks/compare/canbench_results.yml @@ -1,22 +1,127 @@ benches: + read_chunks_btreemap_1: + total: + calls: 1 + instructions: 1219162617 + heap_increase: 3233 + stable_memory_increase: 1665 + scopes: {} + read_chunks_btreemap_1k: + total: + calls: 1 + instructions: 5545847665 + heap_increase: 1604 + stable_memory_increase: 1665 + scopes: {} + read_chunks_btreemap_1m: + total: + calls: 1 + instructions: 135895194651 + heap_increase: 1892 + stable_memory_increase: 3201 + scopes: {} + read_chunks_stable_1: + total: + calls: 1 + instructions: 812767528 + heap_increase: 1601 + stable_memory_increase: 1665 + scopes: {} + read_chunks_stable_1k: + total: + calls: 1 + instructions: 656864785 + heap_increase: 1600 + stable_memory_increase: 1665 + scopes: {} + read_chunks_stable_1m: + total: + calls: 1 + instructions: 1431625779 + heap_increase: 1892 + stable_memory_increase: 1665 + scopes: {} + read_chunks_vec_1: + total: + calls: 1 + instructions: 1363286426 + heap_increase: 3202 + stable_memory_increase: 1665 + scopes: {} + read_chunks_vec_1k: + total: + calls: 1 + instructions: 1509406947 + heap_increase: 3200 + stable_memory_increase: 1665 + scopes: {} + read_chunks_vec_1m: + total: + calls: 1 + instructions: 4839968875 + heap_increase: 3784 + stable_memory_increase: 1665 + scopes: {} + write_chunks_btreemap_1: + total: + calls: 1 + instructions: 1069803034 + heap_increase: 3233 + stable_memory_increase: 1665 + scopes: {} + write_chunks_btreemap_1k: + total: + calls: 1 + instructions: 5045858643 + heap_increase: 1604 + stable_memory_increase: 1665 + scopes: {} + write_chunks_btreemap_1m: + total: + calls: 1 + instructions: 92128802321 + heap_increase: 1892 + stable_memory_increase: 3201 + scopes: {} + write_chunks_stable_1: + total: + calls: 1 + instructions: 418914623 + heap_increase: 1601 + stable_memory_increase: 1665 + scopes: {} + write_chunks_stable_1k: + total: + calls: 1 + instructions: 550955283 + heap_increase: 1600 + stable_memory_increase: 1665 + scopes: {} + write_chunks_stable_1m: + total: + calls: 1 + instructions: 1200987424 + heap_increase: 1892 + stable_memory_increase: 1665 + scopes: {} write_chunks_vec_1: total: calls: 1 - instructions: 1257794454 + instructions: 1257790867 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1k: total: calls: 1 - instructions: 1272107508 + instructions: 1402944650 heap_increase: 3200 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1m: total: calls: 1 - instructions: 3708430886 + instructions: 3830427132 heap_increase: 3784 stable_memory_increase: 1665 scopes: {} diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index d7df58c8..f793d638 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -27,10 +27,10 @@ const fn chunk_size() -> usize { fn chunk_data(n: usize) -> Vec> { let chunk_size = TOTAL_SIZE / n; - (0..n).map(|_| vec![37; chunk_size]).collect() + vec![vec![37; chunk_size]; n] } -// Stable memory benchmarks +// Stable Memory benchmarks fn write_chunks_stable(mem_id: u8, n: usize) { let memory = init_memory(mem_id); @@ -84,7 +84,6 @@ fn read_chunks_btreemap(mem_id: u8, n: usize) { // StableVec benchmarks fn write_chunks_vec(mem_id: u8, n: usize) { - ic_cdk::println!("Chunk size: {}, chunks: {}", CHUNK_SIZE, n); let vec: StableVec, _> = StableVec::new(init_memory(mem_id)).expect("Vec::new failed"); let chunks: Vec<_> = chunk_data(n) @@ -93,8 +92,8 @@ fn write_chunks_vec(mem_id: u8, n: usize) { .collect(); bench_fn(|| { - for chunk in chunks { - vec.push(&chunk).expect("Vec::push failed"); + for chunk in &chunks { + vec.push(chunk).expect("Vec::push failed"); } }); } @@ -111,7 +110,8 @@ fn read_chunks_vec(mem_id: u8, n: usize) { }); } -// Macro to define a single benchmark function +// Benchmark macros + macro_rules! bench_case { ($name:ident, $func:ident, $mem_id:expr, $n:expr) => { #[bench] @@ -121,7 +121,7 @@ macro_rules! bench_case { }; } -macro_rules! bench_case_bounded { +macro_rules! bench_case_sized { ($name:ident, $func:ident, $mem_id:expr, $n:expr) => { #[bench] fn $name() { @@ -131,7 +131,9 @@ macro_rules! bench_case_bounded { }; } -// Stable Memory benchmarks +// Benchmark registrations + +// Stable Memory bench_case!(write_chunks_stable_1, write_chunks_stable, 10, 1); bench_case!(write_chunks_stable_1k, write_chunks_stable, 11, K); bench_case!(write_chunks_stable_1m, write_chunks_stable, 12, M); @@ -139,7 +141,7 @@ bench_case!(read_chunks_stable_1, read_chunks_stable, 20, 1); bench_case!(read_chunks_stable_1k, read_chunks_stable, 21, K); bench_case!(read_chunks_stable_1m, read_chunks_stable, 22, M); -// BTreeMap benchmarks +// BTreeMap bench_case!(write_chunks_btreemap_1, write_chunks_btreemap, 30, 1); bench_case!(write_chunks_btreemap_1k, write_chunks_btreemap, 31, K); bench_case!(write_chunks_btreemap_1m, write_chunks_btreemap, 32, M); @@ -147,12 +149,12 @@ bench_case!(read_chunks_btreemap_1, read_chunks_btreemap, 40, 1); bench_case!(read_chunks_btreemap_1k, read_chunks_btreemap, 41, K); bench_case!(read_chunks_btreemap_1m, read_chunks_btreemap, 42, M); -// StableVec benchmarks -bench_case_bounded!(write_chunks_vec_1, write_chunks_vec, 50, 1); -bench_case_bounded!(write_chunks_vec_1k, write_chunks_vec, 51, K); -bench_case_bounded!(write_chunks_vec_1m, write_chunks_vec, 52, M); -bench_case_bounded!(read_chunks_vec_1, read_chunks_vec, 60, 1); -bench_case_bounded!(read_chunks_vec_1k, read_chunks_vec, 61, K); -bench_case_bounded!(read_chunks_vec_1m, read_chunks_vec, 62, M); +// StableVec +bench_case_sized!(write_chunks_vec_1, write_chunks_vec, 50, 1); +bench_case_sized!(write_chunks_vec_1k, write_chunks_vec, 51, K); +bench_case_sized!(write_chunks_vec_1m, write_chunks_vec, 52, M); +bench_case_sized!(read_chunks_vec_1, read_chunks_vec, 60, 1); +bench_case_sized!(read_chunks_vec_1k, read_chunks_vec, 61, K); +bench_case_sized!(read_chunks_vec_1m, read_chunks_vec, 62, M); fn main() {} From 43748ee38123c9b29af6d6c9dcda414c234f1fed Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 13:32:47 +0200 Subject: [PATCH 03/19] fmt --- benchmarks/btreemap/src/main.rs | 100 ++++++++++++++++---------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/benchmarks/btreemap/src/main.rs b/benchmarks/btreemap/src/main.rs index f3e24835..c60ae421 100644 --- a/benchmarks/btreemap/src/main.rs +++ b/benchmarks/btreemap/src/main.rs @@ -114,18 +114,18 @@ bench_tests! { btreemap_v2_insert_vec_32_1024, insert_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 - btreemap_v2_insert_u64_u64, insert_helper_v2, u64, u64; - btreemap_v2_insert_u64_blob8, insert_helper_v2, u64, Blob8; - btreemap_v2_insert_blob8_u64, insert_helper_v2, Blob8, u64; - btreemap_v2_insert_u64_vec8, insert_helper_v2, u64, UnboundedVec8; - btreemap_v2_insert_vec8_u64, insert_helper_v2, UnboundedVec8, u64; + btreemap_v2_insert_u64_u64, insert_helper_v2, u64, u64; + btreemap_v2_insert_u64_blob8, insert_helper_v2, u64, Blob8; + btreemap_v2_insert_blob8_u64, insert_helper_v2, Blob8, u64; + btreemap_v2_insert_u64_vec8, insert_helper_v2, u64, UnboundedVec8; + btreemap_v2_insert_vec8_u64, insert_helper_v2, UnboundedVec8, u64; // memory manager u64 / blob512 / vec512 - btreemap_v2_mem_manager_insert_u64_u64, insert_helper_v2_mem_manager, u64, u64; - btreemap_v2_mem_manager_insert_u64_blob512, insert_helper_v2_mem_manager, u64, Blob512; - btreemap_v2_mem_manager_insert_blob512_u64, insert_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_insert_u64_vec512, insert_helper_v2_mem_manager, u64, UnboundedVec512; - btreemap_v2_mem_manager_insert_vec512_u64, insert_helper_v2_mem_manager, UnboundedVec512, u64; + btreemap_v2_mem_manager_insert_u64_u64, insert_helper_v2_mem_manager, u64, u64; + btreemap_v2_mem_manager_insert_u64_blob512, insert_helper_v2_mem_manager, u64, Blob512; + btreemap_v2_mem_manager_insert_blob512_u64, insert_helper_v2_mem_manager, Blob512, u64; + btreemap_v2_mem_manager_insert_u64_vec512, insert_helper_v2_mem_manager, u64, UnboundedVec512; + btreemap_v2_mem_manager_insert_vec512_u64, insert_helper_v2_mem_manager, UnboundedVec512, u64; } fn insert_helper_v2() -> BenchResult { @@ -214,18 +214,18 @@ bench_tests! { btreemap_v2_remove_vec_32_1024, remove_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 - btreemap_v2_remove_u64_u64, remove_helper_v2, u64, u64; - btreemap_v2_remove_u64_blob8, remove_helper_v2, u64, Blob8; - btreemap_v2_remove_blob8_u64, remove_helper_v2, Blob8, u64; - btreemap_v2_remove_u64_vec8, remove_helper_v2, u64, UnboundedVec8; - btreemap_v2_remove_vec8_u64, remove_helper_v2, UnboundedVec8, u64; + btreemap_v2_remove_u64_u64, remove_helper_v2, u64, u64; + btreemap_v2_remove_u64_blob8, remove_helper_v2, u64, Blob8; + btreemap_v2_remove_blob8_u64, remove_helper_v2, Blob8, u64; + btreemap_v2_remove_u64_vec8, remove_helper_v2, u64, UnboundedVec8; + btreemap_v2_remove_vec8_u64, remove_helper_v2, UnboundedVec8, u64; // memory manager u64 / blob512 / vec512 - btreemap_v2_mem_manager_remove_u64_u64, remove_helper_v2_mem_manager, u64, u64; - btreemap_v2_mem_manager_remove_u64_blob512, remove_helper_v2_mem_manager, u64, Blob512; - btreemap_v2_mem_manager_remove_blob512_u64, remove_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_remove_u64_vec512, remove_helper_v2_mem_manager, u64, UnboundedVec512; - btreemap_v2_mem_manager_remove_vec512_u64, remove_helper_v2_mem_manager, UnboundedVec512, u64; + btreemap_v2_mem_manager_remove_u64_u64, remove_helper_v2_mem_manager, u64, u64; + btreemap_v2_mem_manager_remove_u64_blob512, remove_helper_v2_mem_manager, u64, Blob512; + btreemap_v2_mem_manager_remove_blob512_u64, remove_helper_v2_mem_manager, Blob512, u64; + btreemap_v2_mem_manager_remove_u64_vec512, remove_helper_v2_mem_manager, u64, UnboundedVec512; + btreemap_v2_mem_manager_remove_vec512_u64, remove_helper_v2_mem_manager, UnboundedVec512, u64; } fn remove_helper_v2() -> BenchResult { @@ -321,18 +321,18 @@ bench_tests! { btreemap_v2_get_vec_32_1024, get_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 - btreemap_v2_get_u64_u64, get_helper_v2, u64, u64; - btreemap_v2_get_u64_blob8, get_helper_v2, u64, Blob8; - btreemap_v2_get_blob8_u64, get_helper_v2, Blob8, u64; - btreemap_v2_get_u64_vec8, get_helper_v2, u64, UnboundedVec8; - btreemap_v2_get_vec8_u64, get_helper_v2, UnboundedVec8, u64; + btreemap_v2_get_u64_u64, get_helper_v2, u64, u64; + btreemap_v2_get_u64_blob8, get_helper_v2, u64, Blob8; + btreemap_v2_get_blob8_u64, get_helper_v2, Blob8, u64; + btreemap_v2_get_u64_vec8, get_helper_v2, u64, UnboundedVec8; + btreemap_v2_get_vec8_u64, get_helper_v2, UnboundedVec8, u64; // memory manager u64 / blob512 / vec512 - btreemap_v2_mem_manager_get_u64_u64, get_helper_v2_mem_manager, u64, u64; - btreemap_v2_mem_manager_get_u64_blob512, get_helper_v2_mem_manager, u64, Blob512; - btreemap_v2_mem_manager_get_blob512_u64, get_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_get_u64_vec512, get_helper_v2_mem_manager, u64, UnboundedVec512; - btreemap_v2_mem_manager_get_vec512_u64, get_helper_v2_mem_manager, UnboundedVec512, u64; + btreemap_v2_mem_manager_get_u64_u64, get_helper_v2_mem_manager, u64, u64; + btreemap_v2_mem_manager_get_u64_blob512, get_helper_v2_mem_manager, u64, Blob512; + btreemap_v2_mem_manager_get_blob512_u64, get_helper_v2_mem_manager, Blob512, u64; + btreemap_v2_mem_manager_get_u64_vec512, get_helper_v2_mem_manager, u64, UnboundedVec512; + btreemap_v2_mem_manager_get_vec512_u64, get_helper_v2_mem_manager, UnboundedVec512, u64; } fn get_helper_v2() -> BenchResult { @@ -428,18 +428,18 @@ bench_tests! { btreemap_v2_contains_vec_32_1024, contains_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 - btreemap_v2_contains_u64_u64, contains_helper_v2, u64, u64; - btreemap_v2_contains_u64_blob8, contains_helper_v2, u64, Blob8; - btreemap_v2_contains_blob8_u64, contains_helper_v2, Blob8, u64; - btreemap_v2_contains_u64_vec8, contains_helper_v2, u64, UnboundedVec8; - btreemap_v2_contains_vec8_u64, contains_helper_v2, UnboundedVec8, u64; + btreemap_v2_contains_u64_u64, contains_helper_v2, u64, u64; + btreemap_v2_contains_u64_blob8, contains_helper_v2, u64, Blob8; + btreemap_v2_contains_blob8_u64, contains_helper_v2, Blob8, u64; + btreemap_v2_contains_u64_vec8, contains_helper_v2, u64, UnboundedVec8; + btreemap_v2_contains_vec8_u64, contains_helper_v2, UnboundedVec8, u64; // memory manager u64 / blob512 / vec512 - btreemap_v2_mem_manager_contains_u64_u64, contains_helper_v2_mem_manager, u64, u64; - btreemap_v2_mem_manager_contains_u64_blob512, contains_helper_v2_mem_manager, u64, Blob512; - btreemap_v2_mem_manager_contains_blob512_u64, contains_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_contains_u64_vec512, contains_helper_v2_mem_manager, u64, UnboundedVec512; - btreemap_v2_mem_manager_contains_vec512_u64, contains_helper_v2_mem_manager, UnboundedVec512, u64; + btreemap_v2_mem_manager_contains_u64_u64, contains_helper_v2_mem_manager, u64, u64; + btreemap_v2_mem_manager_contains_u64_blob512, contains_helper_v2_mem_manager, u64, Blob512; + btreemap_v2_mem_manager_contains_blob512_u64, contains_helper_v2_mem_manager, Blob512, u64; + btreemap_v2_mem_manager_contains_u64_vec512, contains_helper_v2_mem_manager, u64, UnboundedVec512; + btreemap_v2_mem_manager_contains_vec512_u64, contains_helper_v2_mem_manager, UnboundedVec512, u64; } fn contains_helper_v2() -> BenchResult { @@ -557,11 +557,11 @@ bench_tests! { btreemap_v2_pop_first_vec_32_1024, pop_first_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 - btreemap_v2_pop_first_u64_u64, pop_first_helper_v2, u64, u64; - btreemap_v2_pop_first_u64_blob8, pop_first_helper_v2, u64, Blob8; - btreemap_v2_pop_first_blob8_u64, pop_first_helper_v2, Blob8, u64; - btreemap_v2_pop_first_u64_vec8, pop_first_helper_v2, u64, UnboundedVec8; - btreemap_v2_pop_first_vec8_u64, pop_first_helper_v2, UnboundedVec8, u64; + btreemap_v2_pop_first_u64_u64, pop_first_helper_v2, u64, u64; + btreemap_v2_pop_first_u64_blob8, pop_first_helper_v2, u64, Blob8; + btreemap_v2_pop_first_blob8_u64, pop_first_helper_v2, Blob8, u64; + btreemap_v2_pop_first_u64_vec8, pop_first_helper_v2, u64, UnboundedVec8; + btreemap_v2_pop_first_vec8_u64, pop_first_helper_v2, UnboundedVec8, u64; } // Last @@ -611,11 +611,11 @@ bench_tests! { btreemap_v2_pop_last_vec_32_1024, pop_last_helper_v2, UnboundedVec32, UnboundedVec1024; // u64 / blob8 / vec8 - btreemap_v2_pop_last_u64_u64, pop_last_helper_v2, u64, u64; - btreemap_v2_pop_last_u64_blob8, pop_last_helper_v2, u64, Blob8; - btreemap_v2_pop_last_blob8_u64, pop_last_helper_v2, Blob8, u64; - btreemap_v2_pop_last_u64_vec8, pop_last_helper_v2, u64, UnboundedVec8; - btreemap_v2_pop_last_vec8_u64, pop_last_helper_v2, UnboundedVec8, u64; + btreemap_v2_pop_last_u64_u64, pop_last_helper_v2, u64, u64; + btreemap_v2_pop_last_u64_blob8, pop_last_helper_v2, u64, Blob8; + btreemap_v2_pop_last_blob8_u64, pop_last_helper_v2, Blob8, u64; + btreemap_v2_pop_last_u64_vec8, pop_last_helper_v2, u64, UnboundedVec8; + btreemap_v2_pop_last_vec8_u64, pop_last_helper_v2, UnboundedVec8, u64; } fn pop_first_helper_v2() -> BenchResult { From b1756270f2978b5a22ded8e741164378c7d0e112 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 13:34:53 +0200 Subject: [PATCH 04/19] . --- benchmarks/src/common.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index d815a9b3..5237a6dd 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -1,4 +1,4 @@ -use ic_stable_structures::storable::{Blob, Storable, UnboundedVec}; +use ic_stable_structures::storable::{Blob, BoundedVec, Storable, UnboundedVec}; use tiny_rng::{Rand, Rng}; pub trait Random { @@ -29,6 +29,17 @@ impl Random for UnboundedVec { } } +impl Random for BoundedVec { + fn random(rng: &mut Rng) -> Self { + let size = rng.rand_u32() % Self::max_size(); + let mut buf = Vec::with_capacity(size as usize); + for _ in 0..size { + buf.push(rng.rand_u8()); + } + BoundedVec::from(&buf) + } +} + impl Random for u64 { fn random(rng: &mut Rng) -> Self { rng.rand_u64() From 55bc27a280ec5eed4aaa01794aa774c9c1a87001 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 13:53:21 +0200 Subject: [PATCH 05/19] cleanup --- benchmarks/src/common.rs | 4 ++-- src/storable.rs | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index 5237a6dd..bbb94365 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -25,7 +25,7 @@ impl Random for UnboundedVec { for _ in 0..size { buf.push(rng.rand_u8()); } - UnboundedVec::from(&buf) + Self::from(&buf) } } @@ -36,7 +36,7 @@ impl Random for BoundedVec { for _ in 0..size { buf.push(rng.rand_u8()); } - BoundedVec::from(&buf) + Self::from(&buf) } } diff --git a/src/storable.rs b/src/storable.rs index 9bb8fdd2..974e6b99 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -199,9 +199,11 @@ impl UnboundedVec { N as u32 } + /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. pub fn from(slice: &[u8]) -> Self { - assert_eq!(slice.len(), N); - UnboundedVec(slice.to_vec()) + let mut vec = slice[..slice.len().min(N)].to_vec(); + vec.resize(N, 0); + Self(vec) } } @@ -233,9 +235,11 @@ impl BoundedVec { N as u32 } + /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. pub fn from(slice: &[u8]) -> Self { - assert_eq!(slice.len(), N); - BoundedVec(slice.to_vec()) + let mut vec = slice[..slice.len().min(N)].to_vec(); + vec.resize(N, 0); + Self(vec) } } From e69e883decf5a61b22d5d787605d8ad299f70305 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 13:56:06 +0200 Subject: [PATCH 06/19] . --- src/storable.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storable.rs b/src/storable.rs index 974e6b99..db837050 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -190,7 +190,7 @@ impl Storable for Blob { }; } -/// Unbounded vector of bytes filled with up to `N` bytes. +/// Unbounded vector of bytes with length exactly `N`. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] pub struct UnboundedVec(Vec); @@ -226,7 +226,7 @@ impl Storable for UnboundedVec { const BOUND: Bound = Bound::Unbounded; } -/// Bounded vector of bytes filled with up to `N` bytes. +/// Bounded vector of bytes with length exactly `N`. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] pub struct BoundedVec(Vec); From da0aee0be8fff52b40f8eb41b167d1f60f81d1ac Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 14:02:23 +0200 Subject: [PATCH 07/19] vec_n --- benchmarks/btreemap/canbench_results.yml | 452 +++++++++++------------ benchmarks/btreemap/src/main.rs | 276 +++++++------- benchmarks/compare/canbench_results.yml | 36 +- benchmarks/compare/src/main.rs | 8 +- benchmarks/src/common.rs | 6 +- src/storable.rs | 28 +- 6 files changed, 403 insertions(+), 403 deletions(-) diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index 6abd993b..39334633 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -156,126 +156,126 @@ benches: btreemap_v2_contains_vec8_u64: total: calls: 1 - instructions: 373974679 + instructions: 374034547 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_1024_128: total: calls: 1 - instructions: 1847543843 + instructions: 1883505380 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_128_128: total: calls: 1 - instructions: 562946697 + instructions: 581569970 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_16_128: total: calls: 1 - instructions: 432781519 + instructions: 441774976 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_256_128: total: calls: 1 - instructions: 916951505 + instructions: 919041969 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_1024: total: calls: 1 - instructions: 516345708 + instructions: 507791041 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_128: total: calls: 1 - instructions: 437597039 + instructions: 437522595 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_16: total: calls: 1 - instructions: 367092396 + instructions: 367101646 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_256: total: calls: 1 - instructions: 445726845 + instructions: 452279948 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_32: total: calls: 1 - instructions: 367166163 + instructions: 367845880 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_4: total: calls: 1 - instructions: 366267458 + instructions: 366271955 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_512: total: calls: 1 - instructions: 480959847 + instructions: 469571115 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_64: total: calls: 1 - instructions: 407119037 + instructions: 413643615 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_8: total: calls: 1 - instructions: 366285313 + instructions: 366294093 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_4_128: total: calls: 1 - instructions: 398219523 + instructions: 409992534 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_512_128: total: calls: 1 - instructions: 1276595171 + instructions: 1293442122 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_64_128: total: calls: 1 - instructions: 512370490 + instructions: 509329708 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_8_128: total: calls: 1 - instructions: 398244279 + instructions: 403509433 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -436,406 +436,406 @@ benches: btreemap_v2_get_vec8_u64: total: calls: 1 - instructions: 383633031 + instructions: 383701331 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_1024_128: total: calls: 1 - instructions: 1895892021 + instructions: 1884277208 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_128_128: total: calls: 1 - instructions: 575182491 + instructions: 593819676 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_16_128: total: calls: 1 - instructions: 442328780 + instructions: 450878260 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_256_128: total: calls: 1 - instructions: 929706179 + instructions: 931766386 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_1024: total: calls: 1 - instructions: 558668778 + instructions: 537683297 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_128: total: calls: 1 - instructions: 447698379 + instructions: 447491395 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_16: total: calls: 1 - instructions: 374638992 + instructions: 374653964 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_256: total: calls: 1 - instructions: 463244749 + instructions: 487829101 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_32: total: calls: 1 - instructions: 374845455 + instructions: 375526342 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_4: total: calls: 1 - instructions: 374022129 + instructions: 374026626 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_512: total: calls: 1 - instructions: 502894640 + instructions: 492171369 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_64: total: calls: 1 - instructions: 415510238 + instructions: 421604942 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_8: total: calls: 1 - instructions: 374044541 + instructions: 374055167 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_4_128: total: calls: 1 - instructions: 407171466 + instructions: 419988705 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_512_128: total: calls: 1 - instructions: 1289217055 + instructions: 1306356711 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_64_128: total: calls: 1 - instructions: 523089683 + instructions: 519807542 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_8_128: total: calls: 1 - instructions: 407684851 + instructions: 413042044 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_10mib_values: total: calls: 1 - instructions: 5251792410 + instructions: 5253158775 heap_increase: 322 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 451032102 + instructions: 451036077 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: calls: 1 - instructions: 5525788624 + instructions: 5525792626 heap_increase: 0 stable_memory_increase: 196 scopes: {} btreemap_v2_insert_blob_128_128: total: calls: 1 - instructions: 1208821724 + instructions: 1208825750 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: calls: 1 - instructions: 500591510 + instructions: 500595128 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: calls: 1 - instructions: 1817436957 + instructions: 1817440974 heap_increase: 0 stable_memory_increase: 67 scopes: {} btreemap_v2_insert_blob_32_1024: total: calls: 1 - instructions: 724849516 + instructions: 724853356 heap_increase: 0 stable_memory_increase: 173 scopes: {} btreemap_v2_insert_blob_32_128: total: calls: 1 - instructions: 563513821 + instructions: 563517613 heap_increase: 0 stable_memory_increase: 28 scopes: {} btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 539411394 + instructions: 539415306 heap_increase: 0 stable_memory_increase: 11 scopes: {} btreemap_v2_insert_blob_32_256: total: calls: 1 - instructions: 592917952 + instructions: 592921822 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: calls: 1 - instructions: 550204854 + instructions: 550208733 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 530054248 + instructions: 530058175 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: calls: 1 - instructions: 631334646 + instructions: 631338519 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: calls: 1 - instructions: 556446417 + instructions: 556450257 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: calls: 1 - instructions: 538691053 + instructions: 538694836 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: calls: 1 - instructions: 421160972 + instructions: 421163069 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_512_128: total: calls: 1 - instructions: 3070369278 + instructions: 3070373313 heap_increase: 0 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: calls: 1 - instructions: 687224486 + instructions: 687228419 heap_increase: 0 stable_memory_increase: 34 scopes: {} btreemap_v2_insert_blob_8_128: total: calls: 1 - instructions: 473325576 + instructions: 473328702 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 424856496 + instructions: 424861284 heap_increase: 0 stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: calls: 1 - instructions: 433078328 + instructions: 433083407 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 433606280 + instructions: 433683632 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 596675651 + instructions: 596730330 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2791324761 + instructions: 2806277049 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1043141925 + instructions: 1042215458 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 719668309 + instructions: 719055260 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1425303710 + instructions: 1428272800 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1245182314 + instructions: 1244594414 heap_increase: 0 stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 783650019 + instructions: 784462108 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 688714475 + instructions: 688819040 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 908090400 + instructions: 907629663 heap_increase: 0 stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 684433848 + instructions: 684626225 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 683382635 + instructions: 683807690 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 1026429798 + instructions: 1021740044 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 717127989 + instructions: 717697212 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 682695838 + instructions: 683816560 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 621403101 + instructions: 621623051 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1902984657 + instructions: 1907869139 heap_increase: 0 stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 874468583 + instructions: 875795292 heap_increase: 0 stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 680539918 + instructions: 681825641 heap_increase: 0 stable_memory_increase: 23 scopes: {} @@ -870,7 +870,7 @@ benches: btreemap_v2_mem_manager_contains_vec512_u64: total: calls: 1 - instructions: 1263289436 + instructions: 1266313400 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -905,7 +905,7 @@ benches: btreemap_v2_mem_manager_get_vec512_u64: total: calls: 1 - instructions: 1307093929 + instructions: 1310022570 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -933,14 +933,14 @@ benches: btreemap_v2_mem_manager_insert_u64_vec512: total: calls: 1 - instructions: 900560613 + instructions: 905861067 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: calls: 1 - instructions: 2032213941 + instructions: 2039323201 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -975,1022 +975,1022 @@ benches: btreemap_v2_mem_manager_remove_vec512_u64: total: calls: 1 - instructions: 3183910603 + instructions: 3188145309 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob8_u64: total: calls: 1 - instructions: 622200615 + instructions: 622204734 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_1024_128: total: calls: 1 - instructions: 8431485310 + instructions: 8431489312 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_128_128: total: calls: 1 - instructions: 1868788897 + instructions: 1868792923 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_16_128: total: calls: 1 - instructions: 765976333 + instructions: 765979957 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: calls: 1 - instructions: 2807125761 + instructions: 2807129778 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: calls: 1 - instructions: 1151786004 + instructions: 1151789844 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: calls: 1 - instructions: 895271314 + instructions: 895275106 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_16: total: calls: 1 - instructions: 830179005 + instructions: 830182917 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_256: total: calls: 1 - instructions: 924008113 + instructions: 924011983 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_32: total: calls: 1 - instructions: 844939941 + instructions: 844943820 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_4: total: calls: 1 - instructions: 813445762 + instructions: 813449743 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_512: total: calls: 1 - instructions: 988660808 + instructions: 988664675 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_64: total: calls: 1 - instructions: 853670232 + instructions: 853674072 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_8: total: calls: 1 - instructions: 831827208 + instructions: 831831033 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_4_128: total: calls: 1 - instructions: 382997168 + instructions: 382999265 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_512_128: total: calls: 1 - instructions: 4656589101 + instructions: 4656593142 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_64_128: total: calls: 1 - instructions: 1070297882 + instructions: 1070301815 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: calls: 1 - instructions: 626229708 + instructions: 626232852 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_blob8: total: calls: 1 - instructions: 704655932 + instructions: 704660792 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: calls: 1 - instructions: 716277147 + instructions: 716282226 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_vec8: total: calls: 1 - instructions: 707209318 + instructions: 707213350 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec8_u64: total: calls: 1 - instructions: 798415678 + instructions: 798418804 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_1024_128: total: calls: 1 - instructions: 4088132406 + instructions: 4088244642 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_128_128: total: calls: 1 - instructions: 1540235593 + instructions: 1540253392 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_16_128: total: calls: 1 - instructions: 1038779442 + instructions: 1038792519 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_256_128: total: calls: 1 - instructions: 2058259562 + instructions: 2058316631 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_1024: total: calls: 1 - instructions: 1720412114 + instructions: 1720509338 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 1121742438 + instructions: 1121758260 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_16: total: calls: 1 - instructions: 965011199 + instructions: 965015096 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_256: total: calls: 1 - instructions: 1248136179 + instructions: 1248161922 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_32: total: calls: 1 - instructions: 961152870 + instructions: 961156749 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_4: total: calls: 1 - instructions: 954455325 + instructions: 954459165 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_512: total: calls: 1 - instructions: 1404132606 + instructions: 1404192531 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_64: total: calls: 1 - instructions: 1005109166 + instructions: 1005121403 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_8: total: calls: 1 - instructions: 965763854 + instructions: 965767637 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_4_128: total: calls: 1 - instructions: 546598473 + instructions: 546605679 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_512_128: total: calls: 1 - instructions: 2756486259 + instructions: 2756539701 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_64_128: total: calls: 1 - instructions: 1266073864 + instructions: 1266113581 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_8_128: total: calls: 1 - instructions: 859841368 + instructions: 859852036 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob8_u64: total: calls: 1 - instructions: 602347043 + instructions: 602351174 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_1024_128: total: calls: 1 - instructions: 8114668993 + instructions: 8114672995 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_128_128: total: calls: 1 - instructions: 1802553212 + instructions: 1802557238 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_16_128: total: calls: 1 - instructions: 742006771 + instructions: 742010389 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: calls: 1 - instructions: 2718413554 + instructions: 2718417571 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: calls: 1 - instructions: 1117676359 + instructions: 1117680205 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: calls: 1 - instructions: 862736782 + instructions: 862740574 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_16: total: calls: 1 - instructions: 805611949 + instructions: 805615861 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_256: total: calls: 1 - instructions: 895496993 + instructions: 895500863 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_32: total: calls: 1 - instructions: 815542518 + instructions: 815546397 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_4: total: calls: 1 - instructions: 793647234 + instructions: 793651203 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_512: total: calls: 1 - instructions: 965231966 + instructions: 965235827 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_64: total: calls: 1 - instructions: 829954997 + instructions: 829958837 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_8: total: calls: 1 - instructions: 807341792 + instructions: 807345599 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_4_128: total: calls: 1 - instructions: 371628597 + instructions: 371630694 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_512_128: total: calls: 1 - instructions: 4497163453 + instructions: 4497167500 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_64_128: total: calls: 1 - instructions: 1041943727 + instructions: 1041947660 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 622232886 + instructions: 622236018 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_blob8: total: calls: 1 - instructions: 685762802 + instructions: 685767698 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: calls: 1 - instructions: 697134664 + instructions: 697139743 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_vec8: total: calls: 1 - instructions: 688048693 + instructions: 688052725 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec8_u64: total: calls: 1 - instructions: 775814595 + instructions: 775817721 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_1024_128: total: calls: 1 - instructions: 4314793483 + instructions: 4314905725 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_128_128: total: calls: 1 - instructions: 1554207923 + instructions: 1554225722 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_16_128: total: calls: 1 - instructions: 1026108707 + instructions: 1026121769 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_256_128: total: calls: 1 - instructions: 2131957975 + instructions: 2132015032 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_1024: total: calls: 1 - instructions: 1703124978 + instructions: 1703222226 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 1102777839 + instructions: 1102793655 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_16: total: calls: 1 - instructions: 944211580 + instructions: 944215477 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_256: total: calls: 1 - instructions: 1231083615 + instructions: 1231109358 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_32: total: calls: 1 - instructions: 943092699 + instructions: 943096578 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_4: total: calls: 1 - instructions: 940356614 + instructions: 940360454 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_512: total: calls: 1 - instructions: 1394468405 + instructions: 1394528342 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_64: total: calls: 1 - instructions: 986545822 + instructions: 986558074 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_8: total: calls: 1 - instructions: 943858686 + instructions: 943862469 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_4_128: total: calls: 1 - instructions: 536437378 + instructions: 536444584 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_512_128: total: calls: 1 - instructions: 2876049568 + instructions: 2876103010 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_64_128: total: calls: 1 - instructions: 1258690704 + instructions: 1258730445 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_8_128: total: calls: 1 - instructions: 865694095 + instructions: 865704778 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_0b: total: calls: 1 - instructions: 16745 + instructions: 16667 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_10kib: total: calls: 1 - instructions: 2599671 + instructions: 2539479 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_20_10mib: total: calls: 1 - instructions: 20576285 + instructions: 20575441 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_0b: total: calls: 1 - instructions: 17104 + instructions: 17026 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_10kib: total: calls: 1 - instructions: 57215658 + instructions: 57155466 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_20_10mib: total: calls: 1 - instructions: 1105826200 + instructions: 1105825356 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_0b: total: calls: 1 - instructions: 17118 + instructions: 17040 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_10kib: total: calls: 1 - instructions: 57227654 + instructions: 57167462 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_20_10mib: total: calls: 1 - instructions: 1105826436 + instructions: 1105825592 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_10mib_values: total: calls: 1 - instructions: 4737371950 + instructions: 4738924633 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 606056710 + instructions: 606060883 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: calls: 1 - instructions: 7421888863 + instructions: 7421892865 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: calls: 1 - instructions: 1635342144 + instructions: 1635346170 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: calls: 1 - instructions: 690775087 + instructions: 690778699 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: calls: 1 - instructions: 2469317746 + instructions: 2469321763 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: calls: 1 - instructions: 1018120605 + instructions: 1018124451 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: calls: 1 - instructions: 782398055 + instructions: 782401853 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: calls: 1 - instructions: 735719719 + instructions: 735723619 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 818891031 + instructions: 818894907 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: calls: 1 - instructions: 747183764 + instructions: 747187643 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 732221311 + instructions: 732225250 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: calls: 1 - instructions: 891432150 + instructions: 891436017 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: calls: 1 - instructions: 774120262 + instructions: 774124102 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 732105855 + instructions: 732109674 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: calls: 1 - instructions: 468000926 + instructions: 468003047 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: calls: 1 - instructions: 4122884697 + instructions: 4122888732 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: calls: 1 - instructions: 950218276 + instructions: 950222209 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: calls: 1 - instructions: 623528283 + instructions: 623531403 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 601729363 + instructions: 601734235 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: calls: 1 - instructions: 623942722 + instructions: 623947801 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_vec8: total: calls: 1 - instructions: 607719707 + instructions: 607723739 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 767231405 + instructions: 767314029 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4558259611 + instructions: 4547160654 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1461626995 + instructions: 1475219543 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 929190130 + instructions: 930611196 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2290487523 + instructions: 2294122633 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1731690539 + instructions: 1750115612 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1068571017 + instructions: 1063872160 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 891426401 + instructions: 891404552 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1279117440 + instructions: 1307128862 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 898887522 + instructions: 899355709 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 897962086 + instructions: 897968975 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1443964173 + instructions: 1467147462 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 979405970 + instructions: 986665387 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 892013373 + instructions: 891981683 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 669117034 + instructions: 688715164 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 3127395739 + instructions: 3147033903 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1188794438 + instructions: 1200219523 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 837942733 + instructions: 863387246 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_0b: total: calls: 1 - instructions: 1539248 + instructions: 1478450 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_10kib: total: calls: 1 - instructions: 57053250 + instructions: 56992484 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_20_10mib: total: calls: 1 - instructions: 1103719338 + instructions: 1103718289 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_0b: total: calls: 1 - instructions: 1540243 + instructions: 1480165 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_10kib: total: calls: 1 - instructions: 57034269 + instructions: 56974555 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_20_10mib: total: calls: 1 - instructions: 1103718903 + instructions: 1103717868 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_0b: total: calls: 1 - instructions: 1179996 + instructions: 1090848 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_10kib: total: calls: 1 - instructions: 2586983 + instructions: 2498199 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_20_10mib: total: calls: 1 - instructions: 18469912 + instructions: 18468332 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_0b: total: calls: 1 - instructions: 1179911 + instructions: 1092555 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_10kib: total: calls: 1 - instructions: 2568038 + instructions: 2481046 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_20_10mib: total: calls: 1 - instructions: 18469898 + instructions: 18468348 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_0b: total: calls: 1 - instructions: 1515586 + instructions: 1454788 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_10kib: total: calls: 1 - instructions: 57029588 + instructions: 56968822 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_20_10mib: total: calls: 1 - instructions: 1103718868 + instructions: 1103717819 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_0b: total: calls: 1 - instructions: 1517245 + instructions: 1457167 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_10kib: total: calls: 1 - instructions: 57011271 + instructions: 56951557 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_20_10mib: total: calls: 1 - instructions: 1103718445 + instructions: 1103717410 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/btreemap/src/main.rs b/benchmarks/btreemap/src/main.rs index c60ae421..9a9c175c 100644 --- a/benchmarks/btreemap/src/main.rs +++ b/benchmarks/btreemap/src/main.rs @@ -2,7 +2,7 @@ use benchmarks::common::Random; use canbench_rs::{bench, bench_fn, BenchResult}; use ic_stable_structures::memory_manager::{MemoryId, MemoryManager}; use ic_stable_structures::{ - storable::{Blob, UnboundedVec}, + storable::{Blob, UnboundedVecN}, BTreeMap, DefaultMemoryImpl, Memory, Storable, }; use std::ops::Bound; @@ -20,15 +20,15 @@ type Blob512 = Blob<512>; type Blob1024 = Blob<1024>; // Unbounded types. -type UnboundedVec4 = UnboundedVec<4>; -type UnboundedVec8 = UnboundedVec<8>; -type UnboundedVec16 = UnboundedVec<16>; -type UnboundedVec32 = UnboundedVec<32>; -type UnboundedVec64 = UnboundedVec<64>; -type UnboundedVec128 = UnboundedVec<128>; -type UnboundedVec256 = UnboundedVec<256>; -type UnboundedVec512 = UnboundedVec<512>; -type UnboundedVec1024 = UnboundedVec<1024>; +type UnboundedVecN4 = UnboundedVecN<4>; +type UnboundedVecN8 = UnboundedVecN<8>; +type UnboundedVecN16 = UnboundedVecN<16>; +type UnboundedVecN32 = UnboundedVecN<32>; +type UnboundedVecN64 = UnboundedVecN<64>; +type UnboundedVecN128 = UnboundedVecN<128>; +type UnboundedVecN256 = UnboundedVecN<256>; +type UnboundedVecN512 = UnboundedVecN<512>; +type UnboundedVecN1024 = UnboundedVecN<1024>; #[allow(non_upper_case_globals)] const KiB: usize = 1024; @@ -92,40 +92,40 @@ bench_tests! { btreemap_v2_insert_blob_32_1024, insert_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_insert_vec_4_128, insert_helper_v2, UnboundedVec4, UnboundedVec128; - btreemap_v2_insert_vec_8_128, insert_helper_v2, UnboundedVec8, UnboundedVec128; - btreemap_v2_insert_vec_16_128, insert_helper_v2, UnboundedVec16, UnboundedVec128; - btreemap_v2_insert_vec_32_128, insert_helper_v2, UnboundedVec32, UnboundedVec128; - btreemap_v2_insert_vec_64_128, insert_helper_v2, UnboundedVec64, UnboundedVec128; - btreemap_v2_insert_vec_128_128, insert_helper_v2, UnboundedVec128, UnboundedVec128; - btreemap_v2_insert_vec_256_128, insert_helper_v2, UnboundedVec256, UnboundedVec128; - btreemap_v2_insert_vec_512_128, insert_helper_v2, UnboundedVec512, UnboundedVec128; - btreemap_v2_insert_vec_1024_128, insert_helper_v2, UnboundedVec1024, UnboundedVec128; + btreemap_v2_insert_vec_4_128, insert_helper_v2, UnboundedVecN4, UnboundedVecN128; + btreemap_v2_insert_vec_8_128, insert_helper_v2, UnboundedVecN8, UnboundedVecN128; + btreemap_v2_insert_vec_16_128, insert_helper_v2, UnboundedVecN16, UnboundedVecN128; + btreemap_v2_insert_vec_32_128, insert_helper_v2, UnboundedVecN32, UnboundedVecN128; + btreemap_v2_insert_vec_64_128, insert_helper_v2, UnboundedVecN64, UnboundedVecN128; + btreemap_v2_insert_vec_128_128, insert_helper_v2, UnboundedVecN128, UnboundedVecN128; + btreemap_v2_insert_vec_256_128, insert_helper_v2, UnboundedVecN256, UnboundedVecN128; + btreemap_v2_insert_vec_512_128, insert_helper_v2, UnboundedVecN512, UnboundedVecN128; + btreemap_v2_insert_vec_1024_128, insert_helper_v2, UnboundedVecN1024, UnboundedVecN128; // vec 32 x V - btreemap_v2_insert_vec_32_4, insert_helper_v2, UnboundedVec32, UnboundedVec4; - btreemap_v2_insert_vec_32_8, insert_helper_v2, UnboundedVec32, UnboundedVec8; - btreemap_v2_insert_vec_32_16, insert_helper_v2, UnboundedVec32, UnboundedVec16; - btreemap_v2_insert_vec_32_32, insert_helper_v2, UnboundedVec32, UnboundedVec32; - btreemap_v2_insert_vec_32_64, insert_helper_v2, UnboundedVec32, UnboundedVec64; - //btreemap_v2_insert_vec_32_128, insert_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. - btreemap_v2_insert_vec_32_256, insert_helper_v2, UnboundedVec32, UnboundedVec256; - btreemap_v2_insert_vec_32_512, insert_helper_v2, UnboundedVec32, UnboundedVec512; - btreemap_v2_insert_vec_32_1024, insert_helper_v2, UnboundedVec32, UnboundedVec1024; + btreemap_v2_insert_vec_32_4, insert_helper_v2, UnboundedVecN32, UnboundedVecN4; + btreemap_v2_insert_vec_32_8, insert_helper_v2, UnboundedVecN32, UnboundedVecN8; + btreemap_v2_insert_vec_32_16, insert_helper_v2, UnboundedVecN32, UnboundedVecN16; + btreemap_v2_insert_vec_32_32, insert_helper_v2, UnboundedVecN32, UnboundedVecN32; + btreemap_v2_insert_vec_32_64, insert_helper_v2, UnboundedVecN32, UnboundedVecN64; + //btreemap_v2_insert_vec_32_128, insert_helper_v2, UnboundedVecN32, UnboundedVecN128; // Skip repeated. + btreemap_v2_insert_vec_32_256, insert_helper_v2, UnboundedVecN32, UnboundedVecN256; + btreemap_v2_insert_vec_32_512, insert_helper_v2, UnboundedVecN32, UnboundedVecN512; + btreemap_v2_insert_vec_32_1024, insert_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 btreemap_v2_insert_u64_u64, insert_helper_v2, u64, u64; btreemap_v2_insert_u64_blob8, insert_helper_v2, u64, Blob8; btreemap_v2_insert_blob8_u64, insert_helper_v2, Blob8, u64; - btreemap_v2_insert_u64_vec8, insert_helper_v2, u64, UnboundedVec8; - btreemap_v2_insert_vec8_u64, insert_helper_v2, UnboundedVec8, u64; + btreemap_v2_insert_u64_vec8, insert_helper_v2, u64, UnboundedVecN8; + btreemap_v2_insert_vec8_u64, insert_helper_v2, UnboundedVecN8, u64; // memory manager u64 / blob512 / vec512 btreemap_v2_mem_manager_insert_u64_u64, insert_helper_v2_mem_manager, u64, u64; btreemap_v2_mem_manager_insert_u64_blob512, insert_helper_v2_mem_manager, u64, Blob512; btreemap_v2_mem_manager_insert_blob512_u64, insert_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_insert_u64_vec512, insert_helper_v2_mem_manager, u64, UnboundedVec512; - btreemap_v2_mem_manager_insert_vec512_u64, insert_helper_v2_mem_manager, UnboundedVec512, u64; + btreemap_v2_mem_manager_insert_u64_vec512, insert_helper_v2_mem_manager, u64, UnboundedVecN512; + btreemap_v2_mem_manager_insert_vec512_u64, insert_helper_v2_mem_manager, UnboundedVecN512, u64; } fn insert_helper_v2() -> BenchResult { @@ -192,40 +192,40 @@ bench_tests! { btreemap_v2_remove_blob_32_1024, remove_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_remove_vec_4_128, remove_helper_v2, UnboundedVec4, UnboundedVec128; - btreemap_v2_remove_vec_8_128, remove_helper_v2, UnboundedVec8, UnboundedVec128; - btreemap_v2_remove_vec_16_128, remove_helper_v2, UnboundedVec16, UnboundedVec128; - btreemap_v2_remove_vec_32_128, remove_helper_v2, UnboundedVec32, UnboundedVec128; - btreemap_v2_remove_vec_64_128, remove_helper_v2, UnboundedVec64, UnboundedVec128; - btreemap_v2_remove_vec_128_128, remove_helper_v2, UnboundedVec128, UnboundedVec128; - btreemap_v2_remove_vec_256_128, remove_helper_v2, UnboundedVec256, UnboundedVec128; - btreemap_v2_remove_vec_512_128, remove_helper_v2, UnboundedVec512, UnboundedVec128; - btreemap_v2_remove_vec_1024_128, remove_helper_v2, UnboundedVec1024, UnboundedVec128; + btreemap_v2_remove_vec_4_128, remove_helper_v2, UnboundedVecN4, UnboundedVecN128; + btreemap_v2_remove_vec_8_128, remove_helper_v2, UnboundedVecN8, UnboundedVecN128; + btreemap_v2_remove_vec_16_128, remove_helper_v2, UnboundedVecN16, UnboundedVecN128; + btreemap_v2_remove_vec_32_128, remove_helper_v2, UnboundedVecN32, UnboundedVecN128; + btreemap_v2_remove_vec_64_128, remove_helper_v2, UnboundedVecN64, UnboundedVecN128; + btreemap_v2_remove_vec_128_128, remove_helper_v2, UnboundedVecN128, UnboundedVecN128; + btreemap_v2_remove_vec_256_128, remove_helper_v2, UnboundedVecN256, UnboundedVecN128; + btreemap_v2_remove_vec_512_128, remove_helper_v2, UnboundedVecN512, UnboundedVecN128; + btreemap_v2_remove_vec_1024_128, remove_helper_v2, UnboundedVecN1024, UnboundedVecN128; // vec 32 x V - btreemap_v2_remove_vec_32_4, remove_helper_v2, UnboundedVec32, UnboundedVec4; - btreemap_v2_remove_vec_32_8, remove_helper_v2, UnboundedVec32, UnboundedVec8; - btreemap_v2_remove_vec_32_16, remove_helper_v2, UnboundedVec32, UnboundedVec16; - btreemap_v2_remove_vec_32_32, remove_helper_v2, UnboundedVec32, UnboundedVec32; - btreemap_v2_remove_vec_32_64, remove_helper_v2, UnboundedVec32, UnboundedVec64; - //btreemap_v2_remove_vec_32_128, remove_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. - btreemap_v2_remove_vec_32_256, remove_helper_v2, UnboundedVec32, UnboundedVec256; - btreemap_v2_remove_vec_32_512, remove_helper_v2, UnboundedVec32, UnboundedVec512; - btreemap_v2_remove_vec_32_1024, remove_helper_v2, UnboundedVec32, UnboundedVec1024; + btreemap_v2_remove_vec_32_4, remove_helper_v2, UnboundedVecN32, UnboundedVecN4; + btreemap_v2_remove_vec_32_8, remove_helper_v2, UnboundedVecN32, UnboundedVecN8; + btreemap_v2_remove_vec_32_16, remove_helper_v2, UnboundedVecN32, UnboundedVecN16; + btreemap_v2_remove_vec_32_32, remove_helper_v2, UnboundedVecN32, UnboundedVecN32; + btreemap_v2_remove_vec_32_64, remove_helper_v2, UnboundedVecN32, UnboundedVecN64; + //btreemap_v2_remove_vec_32_128, remove_helper_v2, UnboundedVecN32, UnboundedVecN128; // Skip repeated. + btreemap_v2_remove_vec_32_256, remove_helper_v2, UnboundedVecN32, UnboundedVecN256; + btreemap_v2_remove_vec_32_512, remove_helper_v2, UnboundedVecN32, UnboundedVecN512; + btreemap_v2_remove_vec_32_1024, remove_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 btreemap_v2_remove_u64_u64, remove_helper_v2, u64, u64; btreemap_v2_remove_u64_blob8, remove_helper_v2, u64, Blob8; btreemap_v2_remove_blob8_u64, remove_helper_v2, Blob8, u64; - btreemap_v2_remove_u64_vec8, remove_helper_v2, u64, UnboundedVec8; - btreemap_v2_remove_vec8_u64, remove_helper_v2, UnboundedVec8, u64; + btreemap_v2_remove_u64_vec8, remove_helper_v2, u64, UnboundedVecN8; + btreemap_v2_remove_vec8_u64, remove_helper_v2, UnboundedVecN8, u64; // memory manager u64 / blob512 / vec512 btreemap_v2_mem_manager_remove_u64_u64, remove_helper_v2_mem_manager, u64, u64; btreemap_v2_mem_manager_remove_u64_blob512, remove_helper_v2_mem_manager, u64, Blob512; btreemap_v2_mem_manager_remove_blob512_u64, remove_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_remove_u64_vec512, remove_helper_v2_mem_manager, u64, UnboundedVec512; - btreemap_v2_mem_manager_remove_vec512_u64, remove_helper_v2_mem_manager, UnboundedVec512, u64; + btreemap_v2_mem_manager_remove_u64_vec512, remove_helper_v2_mem_manager, u64, UnboundedVecN512; + btreemap_v2_mem_manager_remove_vec512_u64, remove_helper_v2_mem_manager, UnboundedVecN512, u64; } fn remove_helper_v2() -> BenchResult { @@ -299,40 +299,40 @@ bench_tests! { btreemap_v2_get_blob_32_1024, get_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_get_vec_4_128, get_helper_v2, UnboundedVec4, UnboundedVec128; - btreemap_v2_get_vec_8_128, get_helper_v2, UnboundedVec8, UnboundedVec128; - btreemap_v2_get_vec_16_128, get_helper_v2, UnboundedVec16, UnboundedVec128; - btreemap_v2_get_vec_32_128, get_helper_v2, UnboundedVec32, UnboundedVec128; - btreemap_v2_get_vec_64_128, get_helper_v2, UnboundedVec64, UnboundedVec128; - btreemap_v2_get_vec_128_128, get_helper_v2, UnboundedVec128, UnboundedVec128; - btreemap_v2_get_vec_256_128, get_helper_v2, UnboundedVec256, UnboundedVec128; - btreemap_v2_get_vec_512_128, get_helper_v2, UnboundedVec512, UnboundedVec128; - btreemap_v2_get_vec_1024_128, get_helper_v2, UnboundedVec1024, UnboundedVec128; + btreemap_v2_get_vec_4_128, get_helper_v2, UnboundedVecN4, UnboundedVecN128; + btreemap_v2_get_vec_8_128, get_helper_v2, UnboundedVecN8, UnboundedVecN128; + btreemap_v2_get_vec_16_128, get_helper_v2, UnboundedVecN16, UnboundedVecN128; + btreemap_v2_get_vec_32_128, get_helper_v2, UnboundedVecN32, UnboundedVecN128; + btreemap_v2_get_vec_64_128, get_helper_v2, UnboundedVecN64, UnboundedVecN128; + btreemap_v2_get_vec_128_128, get_helper_v2, UnboundedVecN128, UnboundedVecN128; + btreemap_v2_get_vec_256_128, get_helper_v2, UnboundedVecN256, UnboundedVecN128; + btreemap_v2_get_vec_512_128, get_helper_v2, UnboundedVecN512, UnboundedVecN128; + btreemap_v2_get_vec_1024_128, get_helper_v2, UnboundedVecN1024, UnboundedVecN128; // vec 32 x V - btreemap_v2_get_vec_32_4, get_helper_v2, UnboundedVec32, UnboundedVec4; - btreemap_v2_get_vec_32_8, get_helper_v2, UnboundedVec32, UnboundedVec8; - btreemap_v2_get_vec_32_16, get_helper_v2, UnboundedVec32, UnboundedVec16; - btreemap_v2_get_vec_32_32, get_helper_v2, UnboundedVec32, UnboundedVec32; - btreemap_v2_get_vec_32_64, get_helper_v2, UnboundedVec32, UnboundedVec64; - //btreemap_v2_get_vec_32_128, get_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. - btreemap_v2_get_vec_32_256, get_helper_v2, UnboundedVec32, UnboundedVec256; - btreemap_v2_get_vec_32_512, get_helper_v2, UnboundedVec32, UnboundedVec512; - btreemap_v2_get_vec_32_1024, get_helper_v2, UnboundedVec32, UnboundedVec1024; + btreemap_v2_get_vec_32_4, get_helper_v2, UnboundedVecN32, UnboundedVecN4; + btreemap_v2_get_vec_32_8, get_helper_v2, UnboundedVecN32, UnboundedVecN8; + btreemap_v2_get_vec_32_16, get_helper_v2, UnboundedVecN32, UnboundedVecN16; + btreemap_v2_get_vec_32_32, get_helper_v2, UnboundedVecN32, UnboundedVecN32; + btreemap_v2_get_vec_32_64, get_helper_v2, UnboundedVecN32, UnboundedVecN64; + //btreemap_v2_get_vec_32_128, get_helper_v2, UnboundedVecN32, UnboundedVecN128; // Skip repeated. + btreemap_v2_get_vec_32_256, get_helper_v2, UnboundedVecN32, UnboundedVecN256; + btreemap_v2_get_vec_32_512, get_helper_v2, UnboundedVecN32, UnboundedVecN512; + btreemap_v2_get_vec_32_1024, get_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 btreemap_v2_get_u64_u64, get_helper_v2, u64, u64; btreemap_v2_get_u64_blob8, get_helper_v2, u64, Blob8; btreemap_v2_get_blob8_u64, get_helper_v2, Blob8, u64; - btreemap_v2_get_u64_vec8, get_helper_v2, u64, UnboundedVec8; - btreemap_v2_get_vec8_u64, get_helper_v2, UnboundedVec8, u64; + btreemap_v2_get_u64_vec8, get_helper_v2, u64, UnboundedVecN8; + btreemap_v2_get_vec8_u64, get_helper_v2, UnboundedVecN8, u64; // memory manager u64 / blob512 / vec512 btreemap_v2_mem_manager_get_u64_u64, get_helper_v2_mem_manager, u64, u64; btreemap_v2_mem_manager_get_u64_blob512, get_helper_v2_mem_manager, u64, Blob512; btreemap_v2_mem_manager_get_blob512_u64, get_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_get_u64_vec512, get_helper_v2_mem_manager, u64, UnboundedVec512; - btreemap_v2_mem_manager_get_vec512_u64, get_helper_v2_mem_manager, UnboundedVec512, u64; + btreemap_v2_mem_manager_get_u64_vec512, get_helper_v2_mem_manager, u64, UnboundedVecN512; + btreemap_v2_mem_manager_get_vec512_u64, get_helper_v2_mem_manager, UnboundedVecN512, u64; } fn get_helper_v2() -> BenchResult { @@ -406,40 +406,40 @@ bench_tests! { btreemap_v2_contains_blob_32_1024, contains_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_contains_vec_4_128, contains_helper_v2, UnboundedVec4, UnboundedVec128; - btreemap_v2_contains_vec_8_128, contains_helper_v2, UnboundedVec8, UnboundedVec128; - btreemap_v2_contains_vec_16_128, contains_helper_v2, UnboundedVec16, UnboundedVec128; - btreemap_v2_contains_vec_32_128, contains_helper_v2, UnboundedVec32, UnboundedVec128; - btreemap_v2_contains_vec_64_128, contains_helper_v2, UnboundedVec64, UnboundedVec128; - btreemap_v2_contains_vec_128_128, contains_helper_v2, UnboundedVec128, UnboundedVec128; - btreemap_v2_contains_vec_256_128, contains_helper_v2, UnboundedVec256, UnboundedVec128; - btreemap_v2_contains_vec_512_128, contains_helper_v2, UnboundedVec512, UnboundedVec128; - btreemap_v2_contains_vec_1024_128, contains_helper_v2, UnboundedVec1024, UnboundedVec128; + btreemap_v2_contains_vec_4_128, contains_helper_v2, UnboundedVecN4, UnboundedVecN128; + btreemap_v2_contains_vec_8_128, contains_helper_v2, UnboundedVecN8, UnboundedVecN128; + btreemap_v2_contains_vec_16_128, contains_helper_v2, UnboundedVecN16, UnboundedVecN128; + btreemap_v2_contains_vec_32_128, contains_helper_v2, UnboundedVecN32, UnboundedVecN128; + btreemap_v2_contains_vec_64_128, contains_helper_v2, UnboundedVecN64, UnboundedVecN128; + btreemap_v2_contains_vec_128_128, contains_helper_v2, UnboundedVecN128, UnboundedVecN128; + btreemap_v2_contains_vec_256_128, contains_helper_v2, UnboundedVecN256, UnboundedVecN128; + btreemap_v2_contains_vec_512_128, contains_helper_v2, UnboundedVecN512, UnboundedVecN128; + btreemap_v2_contains_vec_1024_128, contains_helper_v2, UnboundedVecN1024, UnboundedVecN128; // vec 32 x V - btreemap_v2_contains_vec_32_4, contains_helper_v2, UnboundedVec32, UnboundedVec4; - btreemap_v2_contains_vec_32_8, contains_helper_v2, UnboundedVec32, UnboundedVec8; - btreemap_v2_contains_vec_32_16, contains_helper_v2, UnboundedVec32, UnboundedVec16; - btreemap_v2_contains_vec_32_32, contains_helper_v2, UnboundedVec32, UnboundedVec32; - btreemap_v2_contains_vec_32_64, contains_helper_v2, UnboundedVec32, UnboundedVec64; - //btreemap_v2_contains_vec_32_128, contains_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. - btreemap_v2_contains_vec_32_256, contains_helper_v2, UnboundedVec32, UnboundedVec256; - btreemap_v2_contains_vec_32_512, contains_helper_v2, UnboundedVec32, UnboundedVec512; - btreemap_v2_contains_vec_32_1024, contains_helper_v2, UnboundedVec32, UnboundedVec1024; + btreemap_v2_contains_vec_32_4, contains_helper_v2, UnboundedVecN32, UnboundedVecN4; + btreemap_v2_contains_vec_32_8, contains_helper_v2, UnboundedVecN32, UnboundedVecN8; + btreemap_v2_contains_vec_32_16, contains_helper_v2, UnboundedVecN32, UnboundedVecN16; + btreemap_v2_contains_vec_32_32, contains_helper_v2, UnboundedVecN32, UnboundedVecN32; + btreemap_v2_contains_vec_32_64, contains_helper_v2, UnboundedVecN32, UnboundedVecN64; + //btreemap_v2_contains_vec_32_128, contains_helper_v2, UnboundedVecN32, UnboundedVecN128; // Skip repeated. + btreemap_v2_contains_vec_32_256, contains_helper_v2, UnboundedVecN32, UnboundedVecN256; + btreemap_v2_contains_vec_32_512, contains_helper_v2, UnboundedVecN32, UnboundedVecN512; + btreemap_v2_contains_vec_32_1024, contains_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 btreemap_v2_contains_u64_u64, contains_helper_v2, u64, u64; btreemap_v2_contains_u64_blob8, contains_helper_v2, u64, Blob8; btreemap_v2_contains_blob8_u64, contains_helper_v2, Blob8, u64; - btreemap_v2_contains_u64_vec8, contains_helper_v2, u64, UnboundedVec8; - btreemap_v2_contains_vec8_u64, contains_helper_v2, UnboundedVec8, u64; + btreemap_v2_contains_u64_vec8, contains_helper_v2, u64, UnboundedVecN8; + btreemap_v2_contains_vec8_u64, contains_helper_v2, UnboundedVecN8, u64; // memory manager u64 / blob512 / vec512 btreemap_v2_mem_manager_contains_u64_u64, contains_helper_v2_mem_manager, u64, u64; btreemap_v2_mem_manager_contains_u64_blob512, contains_helper_v2_mem_manager, u64, Blob512; btreemap_v2_mem_manager_contains_blob512_u64, contains_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_contains_u64_vec512, contains_helper_v2_mem_manager, u64, UnboundedVec512; - btreemap_v2_mem_manager_contains_vec512_u64, contains_helper_v2_mem_manager, UnboundedVec512, u64; + btreemap_v2_mem_manager_contains_u64_vec512, contains_helper_v2_mem_manager, u64, UnboundedVecN512; + btreemap_v2_mem_manager_contains_vec512_u64, contains_helper_v2_mem_manager, UnboundedVecN512, u64; } fn contains_helper_v2() -> BenchResult { @@ -535,33 +535,33 @@ bench_tests! { btreemap_v2_pop_first_blob_32_1024, pop_first_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_pop_first_vec_4_128, pop_first_helper_v2, UnboundedVec4, UnboundedVec128; - btreemap_v2_pop_first_vec_8_128, pop_first_helper_v2, UnboundedVec8, UnboundedVec128; - btreemap_v2_pop_first_vec_16_128, pop_first_helper_v2, UnboundedVec16, UnboundedVec128; - btreemap_v2_pop_first_vec_32_128, pop_first_helper_v2, UnboundedVec32, UnboundedVec128; - btreemap_v2_pop_first_vec_64_128, pop_first_helper_v2, UnboundedVec64, UnboundedVec128; - btreemap_v2_pop_first_vec_128_128, pop_first_helper_v2, UnboundedVec128, UnboundedVec128; - btreemap_v2_pop_first_vec_256_128, pop_first_helper_v2, UnboundedVec256, UnboundedVec128; - btreemap_v2_pop_first_vec_512_128, pop_first_helper_v2, UnboundedVec512, UnboundedVec128; - btreemap_v2_pop_first_vec_1024_128, pop_first_helper_v2, UnboundedVec1024, UnboundedVec128; + btreemap_v2_pop_first_vec_4_128, pop_first_helper_v2, UnboundedVecN4, UnboundedVecN128; + btreemap_v2_pop_first_vec_8_128, pop_first_helper_v2, UnboundedVecN8, UnboundedVecN128; + btreemap_v2_pop_first_vec_16_128, pop_first_helper_v2, UnboundedVecN16, UnboundedVecN128; + btreemap_v2_pop_first_vec_32_128, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN128; + btreemap_v2_pop_first_vec_64_128, pop_first_helper_v2, UnboundedVecN64, UnboundedVecN128; + btreemap_v2_pop_first_vec_128_128, pop_first_helper_v2, UnboundedVecN128, UnboundedVecN128; + btreemap_v2_pop_first_vec_256_128, pop_first_helper_v2, UnboundedVecN256, UnboundedVecN128; + btreemap_v2_pop_first_vec_512_128, pop_first_helper_v2, UnboundedVecN512, UnboundedVecN128; + btreemap_v2_pop_first_vec_1024_128, pop_first_helper_v2, UnboundedVecN1024, UnboundedVecN128; // vec 32 x V - btreemap_v2_pop_first_vec_32_4, pop_first_helper_v2, UnboundedVec32, UnboundedVec4; - btreemap_v2_pop_first_vec_32_8, pop_first_helper_v2, UnboundedVec32, UnboundedVec8; - btreemap_v2_pop_first_vec_32_16, pop_first_helper_v2, UnboundedVec32, UnboundedVec16; - btreemap_v2_pop_first_vec_32_32, pop_first_helper_v2, UnboundedVec32, UnboundedVec32; - btreemap_v2_pop_first_vec_32_64, pop_first_helper_v2, UnboundedVec32, UnboundedVec64; - //btreemap_v2_pop_first_vec_32_128, pop_first_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. - btreemap_v2_pop_first_vec_32_256, pop_first_helper_v2, UnboundedVec32, UnboundedVec256; - btreemap_v2_pop_first_vec_32_512, pop_first_helper_v2, UnboundedVec32, UnboundedVec512; - btreemap_v2_pop_first_vec_32_1024, pop_first_helper_v2, UnboundedVec32, UnboundedVec1024; + btreemap_v2_pop_first_vec_32_4, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN4; + btreemap_v2_pop_first_vec_32_8, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN8; + btreemap_v2_pop_first_vec_32_16, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN16; + btreemap_v2_pop_first_vec_32_32, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN32; + btreemap_v2_pop_first_vec_32_64, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN64; + //btreemap_v2_pop_first_vec_32_128, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN128; // Skip repeated. + btreemap_v2_pop_first_vec_32_256, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN256; + btreemap_v2_pop_first_vec_32_512, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN512; + btreemap_v2_pop_first_vec_32_1024, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 btreemap_v2_pop_first_u64_u64, pop_first_helper_v2, u64, u64; btreemap_v2_pop_first_u64_blob8, pop_first_helper_v2, u64, Blob8; btreemap_v2_pop_first_blob8_u64, pop_first_helper_v2, Blob8, u64; - btreemap_v2_pop_first_u64_vec8, pop_first_helper_v2, u64, UnboundedVec8; - btreemap_v2_pop_first_vec8_u64, pop_first_helper_v2, UnboundedVec8, u64; + btreemap_v2_pop_first_u64_vec8, pop_first_helper_v2, u64, UnboundedVecN8; + btreemap_v2_pop_first_vec8_u64, pop_first_helper_v2, UnboundedVecN8, u64; } // Last @@ -589,33 +589,33 @@ bench_tests! { btreemap_v2_pop_last_blob_32_1024, pop_last_helper_v2, Blob32, Blob1024; // vec K x 128 - btreemap_v2_pop_last_vec_4_128, pop_last_helper_v2, UnboundedVec4, UnboundedVec128; - btreemap_v2_pop_last_vec_8_128, pop_last_helper_v2, UnboundedVec8, UnboundedVec128; - btreemap_v2_pop_last_vec_16_128, pop_last_helper_v2, UnboundedVec16, UnboundedVec128; - btreemap_v2_pop_last_vec_32_128, pop_last_helper_v2, UnboundedVec32, UnboundedVec128; - btreemap_v2_pop_last_vec_64_128, pop_last_helper_v2, UnboundedVec64, UnboundedVec128; - btreemap_v2_pop_last_vec_128_128, pop_last_helper_v2, UnboundedVec128, UnboundedVec128; - btreemap_v2_pop_last_vec_256_128, pop_last_helper_v2, UnboundedVec256, UnboundedVec128; - btreemap_v2_pop_last_vec_512_128, pop_last_helper_v2, UnboundedVec512, UnboundedVec128; - btreemap_v2_pop_last_vec_1024_128, pop_last_helper_v2, UnboundedVec1024, UnboundedVec128; + btreemap_v2_pop_last_vec_4_128, pop_last_helper_v2, UnboundedVecN4, UnboundedVecN128; + btreemap_v2_pop_last_vec_8_128, pop_last_helper_v2, UnboundedVecN8, UnboundedVecN128; + btreemap_v2_pop_last_vec_16_128, pop_last_helper_v2, UnboundedVecN16, UnboundedVecN128; + btreemap_v2_pop_last_vec_32_128, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN128; + btreemap_v2_pop_last_vec_64_128, pop_last_helper_v2, UnboundedVecN64, UnboundedVecN128; + btreemap_v2_pop_last_vec_128_128, pop_last_helper_v2, UnboundedVecN128, UnboundedVecN128; + btreemap_v2_pop_last_vec_256_128, pop_last_helper_v2, UnboundedVecN256, UnboundedVecN128; + btreemap_v2_pop_last_vec_512_128, pop_last_helper_v2, UnboundedVecN512, UnboundedVecN128; + btreemap_v2_pop_last_vec_1024_128, pop_last_helper_v2, UnboundedVecN1024, UnboundedVecN128; // vec 32 x V - btreemap_v2_pop_last_vec_32_4, pop_last_helper_v2, UnboundedVec32, UnboundedVec4; - btreemap_v2_pop_last_vec_32_8, pop_last_helper_v2, UnboundedVec32, UnboundedVec8; - btreemap_v2_pop_last_vec_32_16, pop_last_helper_v2, UnboundedVec32, UnboundedVec16; - btreemap_v2_pop_last_vec_32_32, pop_last_helper_v2, UnboundedVec32, UnboundedVec32; - btreemap_v2_pop_last_vec_32_64, pop_last_helper_v2, UnboundedVec32, UnboundedVec64; - //btreemap_v2_pop_last_vec_32_128, pop_last_helper_v2, UnboundedVec32, UnboundedVec128; // Skip repeated. - btreemap_v2_pop_last_vec_32_256, pop_last_helper_v2, UnboundedVec32, UnboundedVec256; - btreemap_v2_pop_last_vec_32_512, pop_last_helper_v2, UnboundedVec32, UnboundedVec512; - btreemap_v2_pop_last_vec_32_1024, pop_last_helper_v2, UnboundedVec32, UnboundedVec1024; + btreemap_v2_pop_last_vec_32_4, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN4; + btreemap_v2_pop_last_vec_32_8, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN8; + btreemap_v2_pop_last_vec_32_16, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN16; + btreemap_v2_pop_last_vec_32_32, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN32; + btreemap_v2_pop_last_vec_32_64, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN64; + //btreemap_v2_pop_last_vec_32_128, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN128; // Skip repeated. + btreemap_v2_pop_last_vec_32_256, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN256; + btreemap_v2_pop_last_vec_32_512, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN512; + btreemap_v2_pop_last_vec_32_1024, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 btreemap_v2_pop_last_u64_u64, pop_last_helper_v2, u64, u64; btreemap_v2_pop_last_u64_blob8, pop_last_helper_v2, u64, Blob8; btreemap_v2_pop_last_blob8_u64, pop_last_helper_v2, Blob8, u64; - btreemap_v2_pop_last_u64_vec8, pop_last_helper_v2, u64, UnboundedVec8; - btreemap_v2_pop_last_vec8_u64, pop_last_helper_v2, UnboundedVec8, u64; + btreemap_v2_pop_last_u64_vec8, pop_last_helper_v2, u64, UnboundedVecN8; + btreemap_v2_pop_last_vec8_u64, pop_last_helper_v2, UnboundedVecN8, u64; } fn pop_first_helper_v2() -> BenchResult { diff --git a/benchmarks/compare/canbench_results.yml b/benchmarks/compare/canbench_results.yml index 5275e137..91ed2243 100644 --- a/benchmarks/compare/canbench_results.yml +++ b/benchmarks/compare/canbench_results.yml @@ -2,126 +2,126 @@ benches: read_chunks_btreemap_1: total: calls: 1 - instructions: 1219162617 + instructions: 1216692308 heap_increase: 3233 stable_memory_increase: 1665 scopes: {} read_chunks_btreemap_1k: total: calls: 1 - instructions: 5545847665 + instructions: 5503431896 heap_increase: 1604 stable_memory_increase: 1665 scopes: {} read_chunks_btreemap_1m: total: calls: 1 - instructions: 135895194651 + instructions: 135823903847 heap_increase: 1892 stable_memory_increase: 3201 scopes: {} read_chunks_stable_1: total: calls: 1 - instructions: 812767528 + instructions: 812773372 heap_increase: 1601 stable_memory_increase: 1665 scopes: {} read_chunks_stable_1k: total: calls: 1 - instructions: 656864785 + instructions: 656870629 heap_increase: 1600 stable_memory_increase: 1665 scopes: {} read_chunks_stable_1m: total: calls: 1 - instructions: 1431625779 + instructions: 1431631623 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1: total: calls: 1 - instructions: 1363286426 + instructions: 1363292347 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1k: total: calls: 1 - instructions: 1509406947 + instructions: 1509449925 heap_increase: 3200 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1m: total: calls: 1 - instructions: 4839968875 + instructions: 4871982863 heap_increase: 3784 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1: total: calls: 1 - instructions: 1069803034 + instructions: 1068160881 heap_increase: 3233 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1k: total: calls: 1 - instructions: 5045858643 + instructions: 5018672962 heap_increase: 1604 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1m: total: calls: 1 - instructions: 92128802321 + instructions: 92057512469 heap_increase: 1892 stable_memory_increase: 3201 scopes: {} write_chunks_stable_1: total: calls: 1 - instructions: 418914623 + instructions: 418920467 heap_increase: 1601 stable_memory_increase: 1665 scopes: {} write_chunks_stable_1k: total: calls: 1 - instructions: 550955283 + instructions: 550961127 heap_increase: 1600 stable_memory_increase: 1665 scopes: {} write_chunks_stable_1m: total: calls: 1 - instructions: 1200987424 + instructions: 1200993268 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1: total: calls: 1 - instructions: 1257790867 + instructions: 1257796788 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1k: total: calls: 1 - instructions: 1402944650 + instructions: 1402987628 heap_increase: 3200 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1m: total: calls: 1 - instructions: 3830427132 + instructions: 3862441120 heap_increase: 3784 stable_memory_increase: 1665 scopes: {} diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index f793d638..0df5aade 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -2,7 +2,7 @@ use canbench_rs::{bench, bench_fn}; use ic_cdk::api::stable::WASM_PAGE_SIZE_IN_BYTES; use ic_stable_structures::{ memory_manager::{MemoryId, MemoryManager}, - storable::BoundedVec, + storable::BoundedVecN, BTreeMap, DefaultMemoryImpl, Memory, Vec as StableVec, }; @@ -84,11 +84,11 @@ fn read_chunks_btreemap(mem_id: u8, n: usize) { // StableVec benchmarks fn write_chunks_vec(mem_id: u8, n: usize) { - let vec: StableVec, _> = + let vec: StableVec, _> = StableVec::new(init_memory(mem_id)).expect("Vec::new failed"); let chunks: Vec<_> = chunk_data(n) .iter() - .map(|chunk| BoundedVec::from(chunk)) + .map(|chunk| BoundedVecN::from(chunk)) .collect(); bench_fn(|| { @@ -100,7 +100,7 @@ fn write_chunks_vec(mem_id: u8, n: usize) { fn read_chunks_vec(mem_id: u8, n: usize) { write_chunks_vec::(mem_id, n); - let vec: StableVec, _> = + let vec: StableVec, _> = StableVec::init(init_memory(mem_id)).expect("Vec::init failed"); bench_fn(|| { diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index bbb94365..5e283acd 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -1,4 +1,4 @@ -use ic_stable_structures::storable::{Blob, BoundedVec, Storable, UnboundedVec}; +use ic_stable_structures::storable::{Blob, BoundedVecN, Storable, UnboundedVecN}; use tiny_rng::{Rand, Rng}; pub trait Random { @@ -18,7 +18,7 @@ impl Random for Blob { } } -impl Random for UnboundedVec { +impl Random for UnboundedVecN { fn random(rng: &mut Rng) -> Self { let size = rng.rand_u32() % Self::max_size(); let mut buf = Vec::with_capacity(size as usize); @@ -29,7 +29,7 @@ impl Random for UnboundedVec { } } -impl Random for BoundedVec { +impl Random for BoundedVecN { fn random(rng: &mut Rng) -> Self { let size = rng.rand_u32() % Self::max_size(); let mut buf = Vec::with_capacity(size as usize); diff --git a/src/storable.rs b/src/storable.rs index db837050..7d8949c4 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -190,11 +190,11 @@ impl Storable for Blob { }; } -/// Unbounded vector of bytes with length exactly `N`. +/// Unbounded vector of bytes, always of length `N`. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] -pub struct UnboundedVec(Vec); +pub struct UnboundedVecN(Vec); -impl UnboundedVec { +impl UnboundedVecN { pub fn max_size() -> u32 { N as u32 } @@ -207,30 +207,30 @@ impl UnboundedVec { } } -impl Default for UnboundedVec { +impl Default for UnboundedVecN { fn default() -> Self { - UnboundedVec(vec![0; N]) + UnboundedVecN(vec![0; N]) } } -impl Storable for UnboundedVec { +impl Storable for UnboundedVecN { fn to_bytes(&self) -> Cow<[u8]> { Cow::Owned(self.0.clone()) } #[inline] fn from_bytes(bytes: Cow<[u8]>) -> Self { - UnboundedVec(bytes.into_owned()) + UnboundedVecN(bytes.into_owned()) } const BOUND: Bound = Bound::Unbounded; } -/// Bounded vector of bytes with length exactly `N`. +/// Bounded vector of bytes, always of length `N`. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] -pub struct BoundedVec(Vec); +pub struct BoundedVecN(Vec); -impl BoundedVec { +impl BoundedVecN { pub fn max_size() -> u32 { N as u32 } @@ -243,20 +243,20 @@ impl BoundedVec { } } -impl Default for BoundedVec { +impl Default for BoundedVecN { fn default() -> Self { - BoundedVec(vec![0; N]) + BoundedVecN(vec![0; N]) } } -impl Storable for BoundedVec { +impl Storable for BoundedVecN { fn to_bytes(&self) -> Cow<[u8]> { Cow::Owned(self.0.clone()) } #[inline] fn from_bytes(bytes: Cow<[u8]>) -> Self { - BoundedVec(bytes.into_owned()) + BoundedVecN(bytes.into_owned()) } const BOUND: Bound = Bound::Bounded { From 44e30a4e7130969e18aadb57c3fc45aaa6dd6e17 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 14:30:15 +0200 Subject: [PATCH 08/19] . --- benchmarks/btreemap/canbench_results.yml | 454 +++++++++++------------ benchmarks/compare/canbench_results.yml | 36 +- benchmarks/compare/src/main.rs | 3 +- benchmarks/src/common.rs | 36 +- src/storable.rs | 36 +- 5 files changed, 284 insertions(+), 281 deletions(-) diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index 39334633..04536f55 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -156,126 +156,126 @@ benches: btreemap_v2_contains_vec8_u64: total: calls: 1 - instructions: 374034547 + instructions: 373974679 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_1024_128: total: calls: 1 - instructions: 1883505380 + instructions: 1860327164 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_128_128: total: calls: 1 - instructions: 581569970 + instructions: 565425330 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_16_128: total: calls: 1 - instructions: 441774976 + instructions: 433489981 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_256_128: total: calls: 1 - instructions: 919041969 + instructions: 888953526 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_1024: total: calls: 1 - instructions: 507791041 + instructions: 508088514 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_128: total: calls: 1 - instructions: 437522595 + instructions: 421135771 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_16: total: calls: 1 - instructions: 367101646 + instructions: 367058459 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_256: total: calls: 1 - instructions: 452279948 + instructions: 457420710 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_32: total: calls: 1 - instructions: 367845880 + instructions: 367187131 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_4: total: calls: 1 - instructions: 366271955 + instructions: 366327803 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_512: total: calls: 1 - instructions: 469571115 + instructions: 460225458 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_64: total: calls: 1 - instructions: 413643615 + instructions: 413698223 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_8: total: calls: 1 - instructions: 366294093 + instructions: 366429674 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_4_128: total: calls: 1 - instructions: 409992534 + instructions: 397565206 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_512_128: total: calls: 1 - instructions: 1293442122 + instructions: 1216063494 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_64_128: total: calls: 1 - instructions: 509329708 + instructions: 508977208 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_8_128: total: calls: 1 - instructions: 403509433 + instructions: 397826674 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -436,406 +436,406 @@ benches: btreemap_v2_get_vec8_u64: total: calls: 1 - instructions: 383701331 + instructions: 383633031 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_1024_128: total: calls: 1 - instructions: 1884277208 + instructions: 1874046491 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_128_128: total: calls: 1 - instructions: 593819676 + instructions: 577670895 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_16_128: total: calls: 1 - instructions: 450878260 + instructions: 443003543 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_256_128: total: calls: 1 - instructions: 931766386 + instructions: 899926747 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_1024: total: calls: 1 - instructions: 537683297 + instructions: 536729480 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_128: total: calls: 1 - instructions: 447491395 + instructions: 431412714 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_16: total: calls: 1 - instructions: 374653964 + instructions: 374607190 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_256: total: calls: 1 - instructions: 487829101 + instructions: 477085890 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_32: total: calls: 1 - instructions: 375526342 + instructions: 374873394 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_4: total: calls: 1 - instructions: 374026626 + instructions: 374092469 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_512: total: calls: 1 - instructions: 492171369 + instructions: 481932783 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_64: total: calls: 1 - instructions: 421604942 + instructions: 421840468 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_8: total: calls: 1 - instructions: 374055167 + instructions: 374182583 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_4_128: total: calls: 1 - instructions: 419988705 + instructions: 406557304 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_512_128: total: calls: 1 - instructions: 1306356711 + instructions: 1228980542 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_64_128: total: calls: 1 - instructions: 519807542 + instructions: 519680782 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_8_128: total: calls: 1 - instructions: 413042044 + instructions: 407710399 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_10mib_values: total: calls: 1 - instructions: 5253158775 + instructions: 5251792410 heap_increase: 322 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 451036077 + instructions: 451032102 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: calls: 1 - instructions: 5525792626 + instructions: 5525788624 heap_increase: 0 stable_memory_increase: 196 scopes: {} btreemap_v2_insert_blob_128_128: total: calls: 1 - instructions: 1208825750 + instructions: 1208821724 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: calls: 1 - instructions: 500595128 + instructions: 500591510 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: calls: 1 - instructions: 1817440974 + instructions: 1817436957 heap_increase: 0 stable_memory_increase: 67 scopes: {} btreemap_v2_insert_blob_32_1024: total: calls: 1 - instructions: 724853356 + instructions: 724849516 heap_increase: 0 stable_memory_increase: 173 scopes: {} btreemap_v2_insert_blob_32_128: total: calls: 1 - instructions: 563517613 + instructions: 563513821 heap_increase: 0 stable_memory_increase: 28 scopes: {} btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 539415306 + instructions: 539411394 heap_increase: 0 stable_memory_increase: 11 scopes: {} btreemap_v2_insert_blob_32_256: total: calls: 1 - instructions: 592921822 + instructions: 592917952 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: calls: 1 - instructions: 550208733 + instructions: 550204854 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 530058175 + instructions: 530054248 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: calls: 1 - instructions: 631338519 + instructions: 631334646 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: calls: 1 - instructions: 556450257 + instructions: 556446417 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: calls: 1 - instructions: 538694836 + instructions: 538691053 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: calls: 1 - instructions: 421163069 + instructions: 421160972 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_512_128: total: calls: 1 - instructions: 3070373313 + instructions: 3070369278 heap_increase: 0 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: calls: 1 - instructions: 687228419 + instructions: 687224486 heap_increase: 0 stable_memory_increase: 34 scopes: {} btreemap_v2_insert_blob_8_128: total: calls: 1 - instructions: 473328702 + instructions: 473325576 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 424861284 + instructions: 424856496 heap_increase: 0 stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: calls: 1 - instructions: 433083407 + instructions: 433078328 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 433683632 + instructions: 433606280 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 596730330 + instructions: 596675651 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2806277049 + instructions: 2761009617 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1042215458 + instructions: 1044581787 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 719055260 + instructions: 718903559 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1428272800 + instructions: 1430108110 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1244594414 + instructions: 1237302269 heap_increase: 0 stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 784462108 + instructions: 785518193 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 688819040 + instructions: 688673443 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 907629663 + instructions: 896137638 heap_increase: 0 stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 684626225 + instructions: 684832464 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 683807690 + instructions: 683526257 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 1021740044 + instructions: 1016368318 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 717697212 + instructions: 719086186 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 683816560 + instructions: 682790229 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 621623051 + instructions: 621833464 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1907869139 - heap_increase: 0 + instructions: 1906227117 + heap_increase: 1 stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 875795292 + instructions: 879711031 heap_increase: 0 stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 681825641 + instructions: 680695416 heap_increase: 0 stable_memory_increase: 23 scopes: {} @@ -870,7 +870,7 @@ benches: btreemap_v2_mem_manager_contains_vec512_u64: total: calls: 1 - instructions: 1266313400 + instructions: 1265827967 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -905,7 +905,7 @@ benches: btreemap_v2_mem_manager_get_vec512_u64: total: calls: 1 - instructions: 1310022570 + instructions: 1309098118 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -933,14 +933,14 @@ benches: btreemap_v2_mem_manager_insert_u64_vec512: total: calls: 1 - instructions: 905861067 + instructions: 904094053 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: calls: 1 - instructions: 2039323201 + instructions: 2034710889 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -975,1022 +975,1022 @@ benches: btreemap_v2_mem_manager_remove_vec512_u64: total: calls: 1 - instructions: 3188145309 + instructions: 3186405507 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob8_u64: total: calls: 1 - instructions: 622204734 + instructions: 622200615 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_1024_128: total: calls: 1 - instructions: 8431489312 + instructions: 8431485310 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_128_128: total: calls: 1 - instructions: 1868792923 + instructions: 1868788897 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_16_128: total: calls: 1 - instructions: 765979957 + instructions: 765976333 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: calls: 1 - instructions: 2807129778 + instructions: 2807125761 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: calls: 1 - instructions: 1151789844 + instructions: 1151786004 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: calls: 1 - instructions: 895275106 + instructions: 895271314 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_16: total: calls: 1 - instructions: 830182917 + instructions: 830179005 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_256: total: calls: 1 - instructions: 924011983 + instructions: 924008113 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_32: total: calls: 1 - instructions: 844943820 + instructions: 844939941 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_4: total: calls: 1 - instructions: 813449743 + instructions: 813445762 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_512: total: calls: 1 - instructions: 988664675 + instructions: 988660808 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_64: total: calls: 1 - instructions: 853674072 + instructions: 853670232 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_8: total: calls: 1 - instructions: 831831033 + instructions: 831827208 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_4_128: total: calls: 1 - instructions: 382999265 + instructions: 382997168 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_512_128: total: calls: 1 - instructions: 4656593142 + instructions: 4656589101 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_64_128: total: calls: 1 - instructions: 1070301815 + instructions: 1070297882 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: calls: 1 - instructions: 626232852 + instructions: 626229708 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_blob8: total: calls: 1 - instructions: 704660792 + instructions: 704655932 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: calls: 1 - instructions: 716282226 + instructions: 716277147 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_vec8: total: calls: 1 - instructions: 707213350 + instructions: 707209318 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec8_u64: total: calls: 1 - instructions: 798418804 + instructions: 798415678 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_1024_128: total: calls: 1 - instructions: 4088244642 + instructions: 4088132406 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_128_128: total: calls: 1 - instructions: 1540253392 + instructions: 1540235593 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_16_128: total: calls: 1 - instructions: 1038792519 + instructions: 1038779442 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_256_128: total: calls: 1 - instructions: 2058316631 + instructions: 2058259562 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_1024: total: calls: 1 - instructions: 1720509338 + instructions: 1720412114 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 1121758260 + instructions: 1121742423 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_16: total: calls: 1 - instructions: 965015096 + instructions: 965011199 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_256: total: calls: 1 - instructions: 1248161922 + instructions: 1248136179 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_32: total: calls: 1 - instructions: 961156749 + instructions: 961152870 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_4: total: calls: 1 - instructions: 954459165 + instructions: 954455310 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_512: total: calls: 1 - instructions: 1404192531 + instructions: 1404132606 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_64: total: calls: 1 - instructions: 1005121403 + instructions: 1005109166 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_8: total: calls: 1 - instructions: 965767637 + instructions: 965763854 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_4_128: total: calls: 1 - instructions: 546605679 + instructions: 546598473 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_512_128: total: calls: 1 - instructions: 2756539701 + instructions: 2756486259 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_64_128: total: calls: 1 - instructions: 1266113581 + instructions: 1266073864 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_8_128: total: calls: 1 - instructions: 859852036 + instructions: 859841368 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob8_u64: total: calls: 1 - instructions: 602351174 + instructions: 602347043 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_1024_128: total: calls: 1 - instructions: 8114672995 + instructions: 8114668993 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_128_128: total: calls: 1 - instructions: 1802557238 + instructions: 1802553212 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_16_128: total: calls: 1 - instructions: 742010389 + instructions: 742006771 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: calls: 1 - instructions: 2718417571 + instructions: 2718413554 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: calls: 1 - instructions: 1117680205 + instructions: 1117676359 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: calls: 1 - instructions: 862740574 + instructions: 862736782 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_16: total: calls: 1 - instructions: 805615861 + instructions: 805611949 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_256: total: calls: 1 - instructions: 895500863 + instructions: 895496993 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_32: total: calls: 1 - instructions: 815546397 + instructions: 815542518 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_4: total: calls: 1 - instructions: 793651203 + instructions: 793647234 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_512: total: calls: 1 - instructions: 965235827 + instructions: 965231966 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_64: total: calls: 1 - instructions: 829958837 + instructions: 829954997 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_8: total: calls: 1 - instructions: 807345599 + instructions: 807341792 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_4_128: total: calls: 1 - instructions: 371630694 + instructions: 371628597 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_512_128: total: calls: 1 - instructions: 4497167500 + instructions: 4497163453 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_64_128: total: calls: 1 - instructions: 1041947660 + instructions: 1041943727 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 622236018 + instructions: 622232886 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_blob8: total: calls: 1 - instructions: 685767698 + instructions: 685762802 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: calls: 1 - instructions: 697139743 + instructions: 697134664 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_vec8: total: calls: 1 - instructions: 688052725 + instructions: 688048693 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec8_u64: total: calls: 1 - instructions: 775817721 + instructions: 775814595 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_1024_128: total: calls: 1 - instructions: 4314905725 + instructions: 4314793483 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_128_128: total: calls: 1 - instructions: 1554225722 + instructions: 1554207923 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_16_128: total: calls: 1 - instructions: 1026121769 + instructions: 1026108707 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_256_128: total: calls: 1 - instructions: 2132015032 + instructions: 2131957975 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_1024: total: calls: 1 - instructions: 1703222226 + instructions: 1703124978 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 1102793655 + instructions: 1102777824 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_16: total: calls: 1 - instructions: 944215477 + instructions: 944211580 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_256: total: calls: 1 - instructions: 1231109358 + instructions: 1231083615 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_32: total: calls: 1 - instructions: 943096578 + instructions: 943092699 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_4: total: calls: 1 - instructions: 940360454 + instructions: 940356599 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_512: total: calls: 1 - instructions: 1394528342 + instructions: 1394468405 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_64: total: calls: 1 - instructions: 986558074 + instructions: 986545822 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_8: total: calls: 1 - instructions: 943862469 + instructions: 943858686 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_4_128: total: calls: 1 - instructions: 536444584 + instructions: 536437378 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_512_128: total: calls: 1 - instructions: 2876103010 + instructions: 2876049568 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_64_128: total: calls: 1 - instructions: 1258730445 + instructions: 1258690704 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_8_128: total: calls: 1 - instructions: 865704778 + instructions: 865694095 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_0b: total: calls: 1 - instructions: 16667 + instructions: 16745 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_1k_10kib: total: calls: 1 - instructions: 2539479 + instructions: 2599671 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_count_20_10mib: total: calls: 1 - instructions: 20575441 + instructions: 20576285 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_0b: total: calls: 1 - instructions: 17026 + instructions: 17104 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_1k_10kib: total: calls: 1 - instructions: 57155466 + instructions: 57215658 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_key_sum_20_10mib: total: calls: 1 - instructions: 1105825356 + instructions: 1105826200 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_0b: total: calls: 1 - instructions: 17040 + instructions: 17118 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_1k_10kib: total: calls: 1 - instructions: 57167462 + instructions: 57227654 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_range_value_sum_20_10mib: total: calls: 1 - instructions: 1105825592 + instructions: 1105826436 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_10mib_values: total: calls: 1 - instructions: 4738924633 + instructions: 4737371950 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 606060883 + instructions: 606056710 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: calls: 1 - instructions: 7421892865 + instructions: 7421888863 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: calls: 1 - instructions: 1635346170 + instructions: 1635342144 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: calls: 1 - instructions: 690778699 + instructions: 690775087 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: calls: 1 - instructions: 2469321763 + instructions: 2469317746 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: calls: 1 - instructions: 1018124451 + instructions: 1018120605 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: calls: 1 - instructions: 782401853 + instructions: 782398055 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: calls: 1 - instructions: 735723619 + instructions: 735719719 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 818894907 + instructions: 818891031 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: calls: 1 - instructions: 747187643 + instructions: 747183764 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 732225250 + instructions: 732221311 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: calls: 1 - instructions: 891436017 + instructions: 891432150 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: calls: 1 - instructions: 774124102 + instructions: 774120262 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 732109674 + instructions: 732105855 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: calls: 1 - instructions: 468003047 + instructions: 468000926 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: calls: 1 - instructions: 4122888732 + instructions: 4122884697 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: calls: 1 - instructions: 950222209 + instructions: 950218276 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: calls: 1 - instructions: 623531403 + instructions: 623528283 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 601734235 + instructions: 601729363 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: calls: 1 - instructions: 623947801 + instructions: 623942722 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_vec8: total: calls: 1 - instructions: 607723739 + instructions: 607719707 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 767314029 + instructions: 767231405 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4547160654 + instructions: 4494007831 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1475219543 + instructions: 1460612369 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 930611196 + instructions: 929964099 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2294122633 + instructions: 2201264226 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1750115612 + instructions: 1707152362 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1063872160 + instructions: 1057250861 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 891404552 + instructions: 891416961 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1307128862 + instructions: 1273313058 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 899355709 + instructions: 899011040 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 897968975 + instructions: 897947774 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1467147462 + instructions: 1427984953 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 986665387 + instructions: 983939968 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 891981683 + instructions: 892022422 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 688715164 + instructions: 667510837 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 3147033903 + instructions: 2968225990 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1200219523 + instructions: 1188795413 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 863387246 + instructions: 839843886 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_0b: total: calls: 1 - instructions: 1478450 + instructions: 1539248 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_1k_10kib: total: calls: 1 - instructions: 56992484 + instructions: 57053250 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_20_10mib: total: calls: 1 - instructions: 1103718289 + instructions: 1103719338 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_0b: total: calls: 1 - instructions: 1480165 + instructions: 1540243 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_1k_10kib: total: calls: 1 - instructions: 56974555 + instructions: 57034269 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_iter_rev_20_10mib: total: calls: 1 - instructions: 1103717868 + instructions: 1103718903 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_0b: total: calls: 1 - instructions: 1090848 + instructions: 1179996 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_1k_10kib: total: calls: 1 - instructions: 2498199 + instructions: 2586983 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_20_10mib: total: calls: 1 - instructions: 18468332 + instructions: 18469912 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_0b: total: calls: 1 - instructions: 1092555 + instructions: 1179911 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_1k_10kib: total: calls: 1 - instructions: 2481046 + instructions: 2568038 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_keys_rev_20_10mib: total: calls: 1 - instructions: 18468348 + instructions: 18469898 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_0b: total: calls: 1 - instructions: 1454788 + instructions: 1515586 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_1k_10kib: total: calls: 1 - instructions: 56968822 + instructions: 57029588 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_20_10mib: total: calls: 1 - instructions: 1103717819 + instructions: 1103718868 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_0b: total: calls: 1 - instructions: 1457167 + instructions: 1517245 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_1k_10kib: total: calls: 1 - instructions: 56951557 + instructions: 57011271 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_scan_values_rev_20_10mib: total: calls: 1 - instructions: 1103717410 + instructions: 1103718445 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/compare/canbench_results.yml b/benchmarks/compare/canbench_results.yml index 91ed2243..f6b530a3 100644 --- a/benchmarks/compare/canbench_results.yml +++ b/benchmarks/compare/canbench_results.yml @@ -2,126 +2,126 @@ benches: read_chunks_btreemap_1: total: calls: 1 - instructions: 1216692308 + instructions: 1219162536 heap_increase: 3233 stable_memory_increase: 1665 scopes: {} read_chunks_btreemap_1k: total: calls: 1 - instructions: 5503431896 + instructions: 5545655759 heap_increase: 1604 stable_memory_increase: 1665 scopes: {} read_chunks_btreemap_1m: total: calls: 1 - instructions: 135823903847 + instructions: 135388773062 heap_increase: 1892 stable_memory_increase: 3201 scopes: {} read_chunks_stable_1: total: calls: 1 - instructions: 812773372 + instructions: 812767528 heap_increase: 1601 stable_memory_increase: 1665 scopes: {} read_chunks_stable_1k: total: calls: 1 - instructions: 656870629 + instructions: 656864785 heap_increase: 1600 stable_memory_increase: 1665 scopes: {} read_chunks_stable_1m: total: calls: 1 - instructions: 1431631623 + instructions: 1431625779 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1: total: calls: 1 - instructions: 1363292347 + instructions: 1363286562 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1k: total: calls: 1 - instructions: 1509449925 + instructions: 1509460903 heap_increase: 3200 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1m: total: calls: 1 - instructions: 4871982863 + instructions: 4893968831 heap_increase: 3784 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1: total: calls: 1 - instructions: 1068160881 + instructions: 1069803013 heap_increase: 3233 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1k: total: calls: 1 - instructions: 5018672962 + instructions: 5045761922 heap_increase: 1604 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1m: total: calls: 1 - instructions: 92057512469 + instructions: 91887580509 heap_increase: 1892 stable_memory_increase: 3201 scopes: {} write_chunks_stable_1: total: calls: 1 - instructions: 418920467 + instructions: 418914623 heap_increase: 1601 stable_memory_increase: 1665 scopes: {} write_chunks_stable_1k: total: calls: 1 - instructions: 550961127 + instructions: 550955283 heap_increase: 1600 stable_memory_increase: 1665 scopes: {} write_chunks_stable_1m: total: calls: 1 - instructions: 1200993268 + instructions: 1200987424 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1: total: calls: 1 - instructions: 1257796788 + instructions: 1257791003 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1k: total: calls: 1 - instructions: 1402987628 + instructions: 1402998606 heap_increase: 3200 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1m: total: calls: 1 - instructions: 3862441120 + instructions: 3884427088 heap_increase: 3784 stable_memory_increase: 1665 scopes: {} diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index 0df5aade..bd26963c 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -5,6 +5,7 @@ use ic_stable_structures::{ storable::BoundedVecN, BTreeMap, DefaultMemoryImpl, Memory, Vec as StableVec, }; +use std::convert::From; const TOTAL_SIZE: usize = 100 * 1024 * 1024; // 100 MiB const K: usize = 1_000; @@ -88,7 +89,7 @@ fn write_chunks_vec(mem_id: u8, n: usize) { StableVec::new(init_memory(mem_id)).expect("Vec::new failed"); let chunks: Vec<_> = chunk_data(n) .iter() - .map(|chunk| BoundedVecN::from(chunk)) + .map(|chunk| BoundedVecN::from(chunk.as_slice())) .collect(); bench_fn(|| { diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index 5e283acd..c11c8350 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -1,42 +1,38 @@ use ic_stable_structures::storable::{Blob, BoundedVecN, Storable, UnboundedVecN}; +use std::convert::{From, TryFrom}; use tiny_rng::{Rand, Rng}; pub trait Random { fn random(rng: &mut Rng) -> Self; } +fn random_bytes(rng: &mut Rng, max_size: u32) -> Vec { + let size = if max_size > 0 { + (rng.rand_u32() % max_size) as usize + } else { + 0 + }; + rng.iter(Rand::rand_u8).take(size).collect() +} + impl Random for Blob { fn random(rng: &mut Rng) -> Self { - let size = rng.rand_u32() % Blob::::BOUND.max_size(); - Blob::try_from( - rng.iter(Rand::rand_u8) - .take(size as usize) - .collect::>() - .as_slice(), - ) - .unwrap() + let bytes = random_bytes(rng, Blob::::BOUND.max_size()); + Blob::try_from(&bytes[..]).unwrap() } } impl Random for UnboundedVecN { fn random(rng: &mut Rng) -> Self { - let size = rng.rand_u32() % Self::max_size(); - let mut buf = Vec::with_capacity(size as usize); - for _ in 0..size { - buf.push(rng.rand_u8()); - } - Self::from(&buf) + let bytes = random_bytes(rng, Self::max_size()); + Self::from(&bytes[..]) } } impl Random for BoundedVecN { fn random(rng: &mut Rng) -> Self { - let size = rng.rand_u32() % Self::max_size(); - let mut buf = Vec::with_capacity(size as usize); - for _ in 0..size { - buf.push(rng.rand_u8()); - } - Self::from(&buf) + let bytes = random_bytes(rng, Self::max_size()); + Self::from(&bytes[..]) } } diff --git a/src/storable.rs b/src/storable.rs index 7d8949c4..7d93bc93 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -1,7 +1,7 @@ use ic_principal::Principal; use std::borrow::{Borrow, Cow}; use std::cmp::{Ordering, Reverse}; -use std::convert::{TryFrom, TryInto}; +use std::convert::{From, TryFrom, TryInto}; use std::fmt; mod tuples; @@ -198,13 +198,6 @@ impl UnboundedVecN { pub fn max_size() -> u32 { N as u32 } - - /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. - pub fn from(slice: &[u8]) -> Self { - let mut vec = slice[..slice.len().min(N)].to_vec(); - vec.resize(N, 0); - Self(vec) - } } impl Default for UnboundedVecN { @@ -213,6 +206,16 @@ impl Default for UnboundedVecN { } } +impl From<&[u8]> for UnboundedVecN { + /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. + fn from(slice: &[u8]) -> Self { + let mut vec = Vec::with_capacity(N); + vec.extend_from_slice(slice); + vec.resize(N, 0); + Self(vec) + } +} + impl Storable for UnboundedVecN { fn to_bytes(&self) -> Cow<[u8]> { Cow::Owned(self.0.clone()) @@ -234,13 +237,6 @@ impl BoundedVecN { pub fn max_size() -> u32 { N as u32 } - - /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. - pub fn from(slice: &[u8]) -> Self { - let mut vec = slice[..slice.len().min(N)].to_vec(); - vec.resize(N, 0); - Self(vec) - } } impl Default for BoundedVecN { @@ -249,6 +245,16 @@ impl Default for BoundedVecN { } } +impl From<&[u8]> for BoundedVecN { + /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. + fn from(slice: &[u8]) -> Self { + let mut vec = Vec::with_capacity(N); + vec.extend_from_slice(slice); + vec.resize(N, 0); + Self(vec) + } +} + impl Storable for BoundedVecN { fn to_bytes(&self) -> Cow<[u8]> { Cow::Owned(self.0.clone()) From 421a63a07ae84dade9dcb94b041fff47bfae2e67 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 14:33:11 +0200 Subject: [PATCH 09/19] fmt --- benchmarks/btreemap/src/main.rs | 100 ++++++++++++++++---------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/benchmarks/btreemap/src/main.rs b/benchmarks/btreemap/src/main.rs index 9a9c175c..c8781e49 100644 --- a/benchmarks/btreemap/src/main.rs +++ b/benchmarks/btreemap/src/main.rs @@ -114,18 +114,18 @@ bench_tests! { btreemap_v2_insert_vec_32_1024, insert_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 - btreemap_v2_insert_u64_u64, insert_helper_v2, u64, u64; - btreemap_v2_insert_u64_blob8, insert_helper_v2, u64, Blob8; - btreemap_v2_insert_blob8_u64, insert_helper_v2, Blob8, u64; - btreemap_v2_insert_u64_vec8, insert_helper_v2, u64, UnboundedVecN8; - btreemap_v2_insert_vec8_u64, insert_helper_v2, UnboundedVecN8, u64; + btreemap_v2_insert_u64_u64, insert_helper_v2, u64, u64; + btreemap_v2_insert_u64_blob8, insert_helper_v2, u64, Blob8; + btreemap_v2_insert_blob8_u64, insert_helper_v2, Blob8, u64; + btreemap_v2_insert_u64_vec8, insert_helper_v2, u64, UnboundedVecN8; + btreemap_v2_insert_vec8_u64, insert_helper_v2, UnboundedVecN8, u64; // memory manager u64 / blob512 / vec512 - btreemap_v2_mem_manager_insert_u64_u64, insert_helper_v2_mem_manager, u64, u64; - btreemap_v2_mem_manager_insert_u64_blob512, insert_helper_v2_mem_manager, u64, Blob512; - btreemap_v2_mem_manager_insert_blob512_u64, insert_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_insert_u64_vec512, insert_helper_v2_mem_manager, u64, UnboundedVecN512; - btreemap_v2_mem_manager_insert_vec512_u64, insert_helper_v2_mem_manager, UnboundedVecN512, u64; + btreemap_v2_mem_manager_insert_u64_u64, insert_helper_v2_mem_manager, u64, u64; + btreemap_v2_mem_manager_insert_u64_blob512, insert_helper_v2_mem_manager, u64, Blob512; + btreemap_v2_mem_manager_insert_blob512_u64, insert_helper_v2_mem_manager, Blob512, u64; + btreemap_v2_mem_manager_insert_u64_vec512, insert_helper_v2_mem_manager, u64, UnboundedVecN512; + btreemap_v2_mem_manager_insert_vec512_u64, insert_helper_v2_mem_manager, UnboundedVecN512, u64; } fn insert_helper_v2() -> BenchResult { @@ -214,18 +214,18 @@ bench_tests! { btreemap_v2_remove_vec_32_1024, remove_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 - btreemap_v2_remove_u64_u64, remove_helper_v2, u64, u64; - btreemap_v2_remove_u64_blob8, remove_helper_v2, u64, Blob8; - btreemap_v2_remove_blob8_u64, remove_helper_v2, Blob8, u64; - btreemap_v2_remove_u64_vec8, remove_helper_v2, u64, UnboundedVecN8; - btreemap_v2_remove_vec8_u64, remove_helper_v2, UnboundedVecN8, u64; + btreemap_v2_remove_u64_u64, remove_helper_v2, u64, u64; + btreemap_v2_remove_u64_blob8, remove_helper_v2, u64, Blob8; + btreemap_v2_remove_blob8_u64, remove_helper_v2, Blob8, u64; + btreemap_v2_remove_u64_vec8, remove_helper_v2, u64, UnboundedVecN8; + btreemap_v2_remove_vec8_u64, remove_helper_v2, UnboundedVecN8, u64; // memory manager u64 / blob512 / vec512 - btreemap_v2_mem_manager_remove_u64_u64, remove_helper_v2_mem_manager, u64, u64; - btreemap_v2_mem_manager_remove_u64_blob512, remove_helper_v2_mem_manager, u64, Blob512; - btreemap_v2_mem_manager_remove_blob512_u64, remove_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_remove_u64_vec512, remove_helper_v2_mem_manager, u64, UnboundedVecN512; - btreemap_v2_mem_manager_remove_vec512_u64, remove_helper_v2_mem_manager, UnboundedVecN512, u64; + btreemap_v2_mem_manager_remove_u64_u64, remove_helper_v2_mem_manager, u64, u64; + btreemap_v2_mem_manager_remove_u64_blob512, remove_helper_v2_mem_manager, u64, Blob512; + btreemap_v2_mem_manager_remove_blob512_u64, remove_helper_v2_mem_manager, Blob512, u64; + btreemap_v2_mem_manager_remove_u64_vec512, remove_helper_v2_mem_manager, u64, UnboundedVecN512; + btreemap_v2_mem_manager_remove_vec512_u64, remove_helper_v2_mem_manager, UnboundedVecN512, u64; } fn remove_helper_v2() -> BenchResult { @@ -321,18 +321,18 @@ bench_tests! { btreemap_v2_get_vec_32_1024, get_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 - btreemap_v2_get_u64_u64, get_helper_v2, u64, u64; - btreemap_v2_get_u64_blob8, get_helper_v2, u64, Blob8; - btreemap_v2_get_blob8_u64, get_helper_v2, Blob8, u64; - btreemap_v2_get_u64_vec8, get_helper_v2, u64, UnboundedVecN8; - btreemap_v2_get_vec8_u64, get_helper_v2, UnboundedVecN8, u64; + btreemap_v2_get_u64_u64, get_helper_v2, u64, u64; + btreemap_v2_get_u64_blob8, get_helper_v2, u64, Blob8; + btreemap_v2_get_blob8_u64, get_helper_v2, Blob8, u64; + btreemap_v2_get_u64_vec8, get_helper_v2, u64, UnboundedVecN8; + btreemap_v2_get_vec8_u64, get_helper_v2, UnboundedVecN8, u64; // memory manager u64 / blob512 / vec512 - btreemap_v2_mem_manager_get_u64_u64, get_helper_v2_mem_manager, u64, u64; - btreemap_v2_mem_manager_get_u64_blob512, get_helper_v2_mem_manager, u64, Blob512; - btreemap_v2_mem_manager_get_blob512_u64, get_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_get_u64_vec512, get_helper_v2_mem_manager, u64, UnboundedVecN512; - btreemap_v2_mem_manager_get_vec512_u64, get_helper_v2_mem_manager, UnboundedVecN512, u64; + btreemap_v2_mem_manager_get_u64_u64, get_helper_v2_mem_manager, u64, u64; + btreemap_v2_mem_manager_get_u64_blob512, get_helper_v2_mem_manager, u64, Blob512; + btreemap_v2_mem_manager_get_blob512_u64, get_helper_v2_mem_manager, Blob512, u64; + btreemap_v2_mem_manager_get_u64_vec512, get_helper_v2_mem_manager, u64, UnboundedVecN512; + btreemap_v2_mem_manager_get_vec512_u64, get_helper_v2_mem_manager, UnboundedVecN512, u64; } fn get_helper_v2() -> BenchResult { @@ -428,18 +428,18 @@ bench_tests! { btreemap_v2_contains_vec_32_1024, contains_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 - btreemap_v2_contains_u64_u64, contains_helper_v2, u64, u64; - btreemap_v2_contains_u64_blob8, contains_helper_v2, u64, Blob8; - btreemap_v2_contains_blob8_u64, contains_helper_v2, Blob8, u64; - btreemap_v2_contains_u64_vec8, contains_helper_v2, u64, UnboundedVecN8; - btreemap_v2_contains_vec8_u64, contains_helper_v2, UnboundedVecN8, u64; + btreemap_v2_contains_u64_u64, contains_helper_v2, u64, u64; + btreemap_v2_contains_u64_blob8, contains_helper_v2, u64, Blob8; + btreemap_v2_contains_blob8_u64, contains_helper_v2, Blob8, u64; + btreemap_v2_contains_u64_vec8, contains_helper_v2, u64, UnboundedVecN8; + btreemap_v2_contains_vec8_u64, contains_helper_v2, UnboundedVecN8, u64; // memory manager u64 / blob512 / vec512 - btreemap_v2_mem_manager_contains_u64_u64, contains_helper_v2_mem_manager, u64, u64; - btreemap_v2_mem_manager_contains_u64_blob512, contains_helper_v2_mem_manager, u64, Blob512; - btreemap_v2_mem_manager_contains_blob512_u64, contains_helper_v2_mem_manager, Blob512, u64; - btreemap_v2_mem_manager_contains_u64_vec512, contains_helper_v2_mem_manager, u64, UnboundedVecN512; - btreemap_v2_mem_manager_contains_vec512_u64, contains_helper_v2_mem_manager, UnboundedVecN512, u64; + btreemap_v2_mem_manager_contains_u64_u64, contains_helper_v2_mem_manager, u64, u64; + btreemap_v2_mem_manager_contains_u64_blob512, contains_helper_v2_mem_manager, u64, Blob512; + btreemap_v2_mem_manager_contains_blob512_u64, contains_helper_v2_mem_manager, Blob512, u64; + btreemap_v2_mem_manager_contains_u64_vec512, contains_helper_v2_mem_manager, u64, UnboundedVecN512; + btreemap_v2_mem_manager_contains_vec512_u64, contains_helper_v2_mem_manager, UnboundedVecN512, u64; } fn contains_helper_v2() -> BenchResult { @@ -557,11 +557,11 @@ bench_tests! { btreemap_v2_pop_first_vec_32_1024, pop_first_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 - btreemap_v2_pop_first_u64_u64, pop_first_helper_v2, u64, u64; - btreemap_v2_pop_first_u64_blob8, pop_first_helper_v2, u64, Blob8; - btreemap_v2_pop_first_blob8_u64, pop_first_helper_v2, Blob8, u64; - btreemap_v2_pop_first_u64_vec8, pop_first_helper_v2, u64, UnboundedVecN8; - btreemap_v2_pop_first_vec8_u64, pop_first_helper_v2, UnboundedVecN8, u64; + btreemap_v2_pop_first_u64_u64, pop_first_helper_v2, u64, u64; + btreemap_v2_pop_first_u64_blob8, pop_first_helper_v2, u64, Blob8; + btreemap_v2_pop_first_blob8_u64, pop_first_helper_v2, Blob8, u64; + btreemap_v2_pop_first_u64_vec8, pop_first_helper_v2, u64, UnboundedVecN8; + btreemap_v2_pop_first_vec8_u64, pop_first_helper_v2, UnboundedVecN8, u64; } // Last @@ -611,11 +611,11 @@ bench_tests! { btreemap_v2_pop_last_vec_32_1024, pop_last_helper_v2, UnboundedVecN32, UnboundedVecN1024; // u64 / blob8 / vec8 - btreemap_v2_pop_last_u64_u64, pop_last_helper_v2, u64, u64; - btreemap_v2_pop_last_u64_blob8, pop_last_helper_v2, u64, Blob8; - btreemap_v2_pop_last_blob8_u64, pop_last_helper_v2, Blob8, u64; - btreemap_v2_pop_last_u64_vec8, pop_last_helper_v2, u64, UnboundedVecN8; - btreemap_v2_pop_last_vec8_u64, pop_last_helper_v2, UnboundedVecN8, u64; + btreemap_v2_pop_last_u64_u64, pop_last_helper_v2, u64, u64; + btreemap_v2_pop_last_u64_blob8, pop_last_helper_v2, u64, Blob8; + btreemap_v2_pop_last_blob8_u64, pop_last_helper_v2, Blob8, u64; + btreemap_v2_pop_last_u64_vec8, pop_last_helper_v2, u64, UnboundedVecN8; + btreemap_v2_pop_last_vec8_u64, pop_last_helper_v2, UnboundedVecN8, u64; } fn pop_first_helper_v2() -> BenchResult { From df33430932455baed260094e29982ff5e2dc8f3e Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 14:37:05 +0200 Subject: [PATCH 10/19] . --- src/storable.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/storable.rs b/src/storable.rs index 7d93bc93..cc06ca0e 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -200,12 +200,6 @@ impl UnboundedVecN { } } -impl Default for UnboundedVecN { - fn default() -> Self { - UnboundedVecN(vec![0; N]) - } -} - impl From<&[u8]> for UnboundedVecN { /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. fn from(slice: &[u8]) -> Self { @@ -216,6 +210,12 @@ impl From<&[u8]> for UnboundedVecN { } } +impl Default for UnboundedVecN { + fn default() -> Self { + Self(vec![0; N]) + } +} + impl Storable for UnboundedVecN { fn to_bytes(&self) -> Cow<[u8]> { Cow::Owned(self.0.clone()) @@ -239,12 +239,6 @@ impl BoundedVecN { } } -impl Default for BoundedVecN { - fn default() -> Self { - BoundedVecN(vec![0; N]) - } -} - impl From<&[u8]> for BoundedVecN { /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. fn from(slice: &[u8]) -> Self { @@ -255,6 +249,12 @@ impl From<&[u8]> for BoundedVecN { } } +impl Default for BoundedVecN { + fn default() -> Self { + Self(vec![0; N]) + } +} + impl Storable for BoundedVecN { fn to_bytes(&self) -> Cow<[u8]> { Cow::Owned(self.0.clone()) From d19b0a2f5b5c0bca589a39c20282f744f7aa9e53 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 14:37:45 +0200 Subject: [PATCH 11/19] . --- src/storable.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storable.rs b/src/storable.rs index cc06ca0e..8cadff1d 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -223,7 +223,7 @@ impl Storable for UnboundedVecN { #[inline] fn from_bytes(bytes: Cow<[u8]>) -> Self { - UnboundedVecN(bytes.into_owned()) + Self(bytes.into_owned()) } const BOUND: Bound = Bound::Unbounded; @@ -262,7 +262,7 @@ impl Storable for BoundedVecN { #[inline] fn from_bytes(bytes: Cow<[u8]>) -> Self { - BoundedVecN(bytes.into_owned()) + Self(bytes.into_owned()) } const BOUND: Bound = Bound::Bounded { From 673a4b204b495a59f244f0ddc206dac0cd81a70e Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 14:49:48 +0200 Subject: [PATCH 12/19] . --- benchmarks/btreemap/canbench_results.yml | 526 +++++++++++------------ benchmarks/compare/canbench_results.yml | 30 +- benchmarks/compare/src/main.rs | 5 +- benchmarks/src/common.rs | 21 +- src/storable.rs | 14 +- 5 files changed, 299 insertions(+), 297 deletions(-) diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index 04536f55..cf64c547 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -9,133 +9,133 @@ benches: btreemap_v2_contains_blob8_u64: total: calls: 1 - instructions: 283243186 + instructions: 279569335 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_1024_128: total: calls: 1 - instructions: 4294894392 + instructions: 4252090802 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_128_128: total: calls: 1 - instructions: 840909876 + instructions: 836767629 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_16_128: total: calls: 1 - instructions: 300105736 + instructions: 298399964 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_256_128: total: calls: 1 - instructions: 1326771401 + instructions: 1331409437 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_1024: total: calls: 1 - instructions: 337445350 + instructions: 342949922 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_128: total: calls: 1 - instructions: 337242957 + instructions: 338902257 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_16: total: calls: 1 - instructions: 329500229 + instructions: 333473127 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_256: total: calls: 1 - instructions: 335682009 + instructions: 342966469 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_32: total: calls: 1 - instructions: 342487367 + instructions: 342186936 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_4: total: calls: 1 - instructions: 333741840 + instructions: 339341982 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_512: total: calls: 1 - instructions: 333192029 + instructions: 332480516 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_64: total: calls: 1 - instructions: 337617773 + instructions: 343378710 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_8: total: calls: 1 - instructions: 335387695 + instructions: 345447518 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_4_128: total: calls: 1 - instructions: 250355530 + instructions: 260662505 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_512_128: total: calls: 1 - instructions: 2298434691 + instructions: 2311684525 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_64_128: total: calls: 1 - instructions: 419606574 + instructions: 412874162 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_8_128: total: calls: 1 - instructions: 273336147 + instructions: 274425199 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_u64_blob8: total: calls: 1 - instructions: 225499211 + instructions: 225260904 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -149,133 +149,133 @@ benches: btreemap_v2_contains_u64_vec8: total: calls: 1 - instructions: 225499211 + instructions: 224953296 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec8_u64: total: calls: 1 - instructions: 373974679 + instructions: 370675389 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_1024_128: total: calls: 1 - instructions: 1860327164 + instructions: 1885377607 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_128_128: total: calls: 1 - instructions: 565425330 + instructions: 579039587 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_16_128: total: calls: 1 - instructions: 433489981 + instructions: 437534302 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_256_128: total: calls: 1 - instructions: 888953526 + instructions: 894442266 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_1024: total: calls: 1 - instructions: 508088514 + instructions: 530472614 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_128: total: calls: 1 - instructions: 421135771 + instructions: 434280371 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_16: total: calls: 1 - instructions: 367058459 + instructions: 364842018 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_256: total: calls: 1 - instructions: 457420710 + instructions: 452917962 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_32: total: calls: 1 - instructions: 367187131 + instructions: 365391924 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_4: total: calls: 1 - instructions: 366327803 + instructions: 366781307 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_512: total: calls: 1 - instructions: 460225458 + instructions: 459219450 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_64: total: calls: 1 - instructions: 413698223 + instructions: 372710499 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_8: total: calls: 1 - instructions: 366429674 + instructions: 371552858 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_4_128: total: calls: 1 - instructions: 397565206 + instructions: 382299653 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_512_128: total: calls: 1 - instructions: 1216063494 + instructions: 1250788225 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_64_128: total: calls: 1 - instructions: 508977208 + instructions: 501846618 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_8_128: total: calls: 1 - instructions: 397826674 + instructions: 397177602 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -289,133 +289,133 @@ benches: btreemap_v2_get_blob8_u64: total: calls: 1 - instructions: 294497964 + instructions: 296412706 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_1024_128: total: calls: 1 - instructions: 4434041253 + instructions: 4391175660 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_128_128: total: calls: 1 - instructions: 874096444 + instructions: 869705084 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_16_128: total: calls: 1 - instructions: 313526179 + instructions: 311596744 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_256_128: total: calls: 1 - instructions: 1373148630 + instructions: 1377810968 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_1024: total: calls: 1 - instructions: 357155881 + instructions: 362674081 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_128: total: calls: 1 - instructions: 351535572 + instructions: 353310194 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_16: total: calls: 1 - instructions: 340461038 + instructions: 344026436 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_256: total: calls: 1 - instructions: 351061577 + instructions: 358509346 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_32: total: calls: 1 - instructions: 353942159 + instructions: 353448060 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_4: total: calls: 1 - instructions: 343418312 + instructions: 349342451 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_512: total: calls: 1 - instructions: 350194697 + instructions: 349424862 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_64: total: calls: 1 - instructions: 350423636 + instructions: 356281938 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_8: total: calls: 1 - instructions: 345686334 + instructions: 355327040 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_4_128: total: calls: 1 - instructions: 262413920 + instructions: 273429355 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_512_128: total: calls: 1 - instructions: 2375697187 + instructions: 2389001360 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_64_128: total: calls: 1 - instructions: 443018386 + instructions: 436454565 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_8_128: total: calls: 1 - instructions: 286466150 + instructions: 287583033 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_u64_blob8: total: calls: 1 - instructions: 235941207 + instructions: 235792600 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -429,133 +429,133 @@ benches: btreemap_v2_get_u64_vec8: total: calls: 1 - instructions: 236688731 + instructions: 236162395 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec8_u64: total: calls: 1 - instructions: 383633031 + instructions: 380833850 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_1024_128: total: calls: 1 - instructions: 1874046491 + instructions: 1899841865 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_128_128: total: calls: 1 - instructions: 577670895 + instructions: 591338628 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_16_128: total: calls: 1 - instructions: 443003543 + instructions: 446767446 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_256_128: total: calls: 1 - instructions: 899926747 + instructions: 907173506 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_1024: total: calls: 1 - instructions: 536729480 + instructions: 558700232 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_128: total: calls: 1 - instructions: 431412714 + instructions: 444141723 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_16: total: calls: 1 - instructions: 374607190 + instructions: 372416012 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_256: total: calls: 1 - instructions: 477085890 + instructions: 479596965 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_32: total: calls: 1 - instructions: 374873394 + instructions: 373075356 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_4: total: calls: 1 - instructions: 374092469 + instructions: 376733864 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_512: total: calls: 1 - instructions: 481932783 + instructions: 486288823 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_64: total: calls: 1 - instructions: 421840468 + instructions: 382635141 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_8: total: calls: 1 - instructions: 374182583 + instructions: 381368135 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_4_128: total: calls: 1 - instructions: 406557304 + instructions: 391250794 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_512_128: total: calls: 1 - instructions: 1228980542 + instructions: 1264637463 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_64_128: total: calls: 1 - instructions: 519680782 + instructions: 512502419 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_8_128: total: calls: 1 - instructions: 407710399 + instructions: 406227911 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -569,135 +569,135 @@ benches: btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 451032102 + instructions: 455947363 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: calls: 1 - instructions: 5525788624 + instructions: 5523594541 heap_increase: 0 - stable_memory_increase: 196 + stable_memory_increase: 199 scopes: {} btreemap_v2_insert_blob_128_128: total: calls: 1 - instructions: 1208821724 + instructions: 1203218447 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: calls: 1 - instructions: 500591510 + instructions: 501467725 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: calls: 1 - instructions: 1817436957 + instructions: 1830073450 heap_increase: 0 - stable_memory_increase: 67 + stable_memory_increase: 68 scopes: {} btreemap_v2_insert_blob_32_1024: total: calls: 1 - instructions: 724849516 + instructions: 725043434 heap_increase: 0 - stable_memory_increase: 173 + stable_memory_increase: 172 scopes: {} btreemap_v2_insert_blob_32_128: total: calls: 1 - instructions: 563513821 + instructions: 566142273 heap_increase: 0 - stable_memory_increase: 28 + stable_memory_increase: 29 scopes: {} btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 539411394 + instructions: 546543871 heap_increase: 0 - stable_memory_increase: 11 + stable_memory_increase: 10 scopes: {} btreemap_v2_insert_blob_32_256: total: calls: 1 - instructions: 592917952 + instructions: 593776963 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: calls: 1 - instructions: 550204854 + instructions: 552918385 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 530054248 + instructions: 534267119 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: calls: 1 - instructions: 631334646 + instructions: 638561772 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: calls: 1 - instructions: 556446417 + instructions: 561110368 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: calls: 1 - instructions: 538691053 + instructions: 540640060 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: calls: 1 - instructions: 421160972 + instructions: 443092010 heap_increase: 0 - stable_memory_increase: 13 + stable_memory_increase: 16 scopes: {} btreemap_v2_insert_blob_512_128: total: calls: 1 - instructions: 3070369278 + instructions: 3059129166 heap_increase: 0 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: calls: 1 - instructions: 687224486 + instructions: 690664526 heap_increase: 0 - stable_memory_increase: 34 + stable_memory_increase: 35 scopes: {} btreemap_v2_insert_blob_8_128: total: calls: 1 - instructions: 473325576 + instructions: 474598915 heap_increase: 0 - stable_memory_increase: 20 + stable_memory_increase: 21 scopes: {} btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 424856496 + instructions: 426060715 heap_increase: 0 - stable_memory_increase: 5 + stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_u64: total: @@ -709,147 +709,147 @@ benches: btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 433606280 + instructions: 433283181 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 596675651 + instructions: 599847919 heap_increase: 0 - stable_memory_increase: 16 + stable_memory_increase: 17 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2761009617 + instructions: 2758769053 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1044581787 + instructions: 1040490586 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 718903559 + instructions: 721318329 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1430108110 + instructions: 1427609829 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1237302269 + instructions: 1224523750 heap_increase: 0 - stable_memory_increase: 171 + stable_memory_increase: 172 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 785518193 + instructions: 789028402 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 688673443 + instructions: 687817166 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 896137638 + instructions: 885542609 heap_increase: 0 - stable_memory_increase: 54 + stable_memory_increase: 55 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 684832464 + instructions: 683910327 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 683526257 + instructions: 681997994 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 1016368318 + instructions: 1007210069 heap_increase: 0 - stable_memory_increase: 91 + stable_memory_increase: 90 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 719086186 + instructions: 721433712 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 682790229 + instructions: 684122424 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 621833464 + instructions: 649744561 heap_increase: 0 - stable_memory_increase: 16 + stable_memory_increase: 19 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1906227117 - heap_increase: 1 - stable_memory_increase: 112 + instructions: 1896249533 + heap_increase: 0 + stable_memory_increase: 113 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 879711031 + instructions: 880005792 heap_increase: 0 - stable_memory_increase: 41 + stable_memory_increase: 40 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 680695416 + instructions: 682855042 heap_increase: 0 - stable_memory_increase: 23 + stable_memory_increase: 25 scopes: {} btreemap_v2_mem_manager_contains_blob512_u64: total: calls: 1 - instructions: 2393561731 + instructions: 2415717136 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_contains_u64_blob512: total: calls: 1 - instructions: 301490930 + instructions: 300203853 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -863,28 +863,28 @@ benches: btreemap_v2_mem_manager_contains_u64_vec512: total: calls: 1 - instructions: 389757738 + instructions: 388598332 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_contains_vec512_u64: total: calls: 1 - instructions: 1265827967 + instructions: 1257778723 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_blob512_u64: total: calls: 1 - instructions: 2480010677 + instructions: 2502172666 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_blob512: total: calls: 1 - instructions: 318984422 + instructions: 317655937 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -898,28 +898,28 @@ benches: btreemap_v2_mem_manager_get_u64_vec512: total: calls: 1 - instructions: 416829257 + instructions: 415844924 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_vec512_u64: total: calls: 1 - instructions: 1309098118 + instructions: 1300334542 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_blob512_u64: total: calls: 1 - instructions: 3189283499 + instructions: 3197554675 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_blob512: total: calls: 1 - instructions: 647090916 + instructions: 646132134 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -933,28 +933,28 @@ benches: btreemap_v2_mem_manager_insert_u64_vec512: total: calls: 1 - instructions: 904094053 + instructions: 904433699 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: calls: 1 - instructions: 2034710889 - heap_increase: 0 + instructions: 2032393223 + heap_increase: 1 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_blob512_u64: total: calls: 1 - instructions: 4412188235 + instructions: 4341376848 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_blob512: total: calls: 1 - instructions: 950509465 + instructions: 932100749 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -968,147 +968,147 @@ benches: btreemap_v2_mem_manager_remove_u64_vec512: total: calls: 1 - instructions: 1289646675 + instructions: 1267125799 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_vec512_u64: total: calls: 1 - instructions: 3186405507 + instructions: 3131312791 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob8_u64: total: calls: 1 - instructions: 622200615 + instructions: 637404895 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_1024_128: total: calls: 1 - instructions: 8431485310 + instructions: 8480747187 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_128_128: total: calls: 1 - instructions: 1868788897 + instructions: 1833661013 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_16_128: total: calls: 1 - instructions: 765976333 + instructions: 776414626 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: calls: 1 - instructions: 2807125761 + instructions: 2819191495 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: calls: 1 - instructions: 1151786004 + instructions: 1151687300 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: calls: 1 - instructions: 895271314 + instructions: 881572332 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_16: total: calls: 1 - instructions: 830179005 + instructions: 842465657 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_256: total: calls: 1 - instructions: 924008113 + instructions: 925437514 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_32: total: calls: 1 - instructions: 844939941 + instructions: 849846670 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_4: total: calls: 1 - instructions: 813445762 + instructions: 825410462 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_512: total: calls: 1 - instructions: 988660808 + instructions: 1000162337 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_64: total: calls: 1 - instructions: 853670232 + instructions: 863521416 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_8: total: calls: 1 - instructions: 831827208 + instructions: 842827911 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_4_128: total: calls: 1 - instructions: 382997168 + instructions: 473187449 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_512_128: total: calls: 1 - instructions: 4656589101 + instructions: 4716328635 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_64_128: total: calls: 1 - instructions: 1070297882 + instructions: 1078455583 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: calls: 1 - instructions: 626229708 + instructions: 660040421 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_blob8: total: calls: 1 - instructions: 704655932 + instructions: 702819873 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1122,266 +1122,266 @@ benches: btreemap_v2_pop_first_u64_vec8: total: calls: 1 - instructions: 707209318 + instructions: 702597937 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec8_u64: total: calls: 1 - instructions: 798415678 + instructions: 813651829 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_1024_128: total: calls: 1 - instructions: 4088132406 + instructions: 4092222458 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_128_128: total: calls: 1 - instructions: 1540235593 + instructions: 1526831623 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_16_128: total: calls: 1 - instructions: 1038779442 + instructions: 1053741471 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_256_128: total: calls: 1 - instructions: 2058259562 + instructions: 2053487698 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_1024: total: calls: 1 - instructions: 1720412114 + instructions: 1729155939 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 1121742423 + instructions: 1110845516 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_16: total: calls: 1 - instructions: 965011199 + instructions: 972222163 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_256: total: calls: 1 - instructions: 1248136179 + instructions: 1250812350 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_32: total: calls: 1 - instructions: 961152870 + instructions: 967928426 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_4: total: calls: 1 - instructions: 954455310 + instructions: 962873752 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_512: total: calls: 1 - instructions: 1404132606 + instructions: 1417784478 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_64: total: calls: 1 - instructions: 1005109166 + instructions: 1013091366 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_8: total: calls: 1 - instructions: 965763854 + instructions: 967302305 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_4_128: total: calls: 1 - instructions: 546598473 + instructions: 673493909 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_512_128: total: calls: 1 - instructions: 2756486259 + instructions: 2784783301 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_64_128: total: calls: 1 - instructions: 1266073864 + instructions: 1269719778 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_8_128: total: calls: 1 - instructions: 859841368 + instructions: 905541083 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob8_u64: total: calls: 1 - instructions: 602347043 + instructions: 631859405 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_1024_128: total: calls: 1 - instructions: 8114668993 + instructions: 8161739568 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_128_128: total: calls: 1 - instructions: 1802553212 + instructions: 1787654636 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_16_128: total: calls: 1 - instructions: 742006771 + instructions: 760709963 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: calls: 1 - instructions: 2718413554 + instructions: 2735047433 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: calls: 1 - instructions: 1117676359 + instructions: 1127339781 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: calls: 1 - instructions: 862736782 + instructions: 858830001 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_16: total: calls: 1 - instructions: 805611949 + instructions: 821903648 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_256: total: calls: 1 - instructions: 895496993 + instructions: 901391139 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_32: total: calls: 1 - instructions: 815542518 + instructions: 832450055 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_4: total: calls: 1 - instructions: 793647234 + instructions: 808702620 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_512: total: calls: 1 - instructions: 965231966 + instructions: 976679720 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_64: total: calls: 1 - instructions: 829954997 + instructions: 842453541 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_8: total: calls: 1 - instructions: 807341792 + instructions: 817181157 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_4_128: total: calls: 1 - instructions: 371628597 + instructions: 459896962 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_512_128: total: calls: 1 - instructions: 4497163453 + instructions: 4554791885 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_64_128: total: calls: 1 - instructions: 1041943727 + instructions: 1049586965 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 622232886 + instructions: 640092931 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_blob8: total: calls: 1 - instructions: 685762802 + instructions: 683734819 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1395,133 +1395,133 @@ benches: btreemap_v2_pop_last_u64_vec8: total: calls: 1 - instructions: 688048693 + instructions: 683739104 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec8_u64: total: calls: 1 - instructions: 775814595 + instructions: 806560393 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_1024_128: total: calls: 1 - instructions: 4314793483 + instructions: 4320770299 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_128_128: total: calls: 1 - instructions: 1554207923 + instructions: 1552489406 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_16_128: total: calls: 1 - instructions: 1026108707 + instructions: 1050247309 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_256_128: total: calls: 1 - instructions: 2131957975 + instructions: 2141202369 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_1024: total: calls: 1 - instructions: 1703124978 + instructions: 1718322608 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 1102777824 + instructions: 1102680067 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_16: total: calls: 1 - instructions: 944211580 + instructions: 958367696 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_256: total: calls: 1 - instructions: 1231083615 + instructions: 1239114989 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_32: total: calls: 1 - instructions: 943092699 + instructions: 961260413 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_4: total: calls: 1 - instructions: 940356599 + instructions: 945626469 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_512: total: calls: 1 - instructions: 1394468405 + instructions: 1405148216 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_64: total: calls: 1 - instructions: 986545822 + instructions: 996845151 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_8: total: calls: 1 - instructions: 943858686 + instructions: 949870993 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_4_128: total: calls: 1 - instructions: 536437378 + instructions: 661701806 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_512_128: total: calls: 1 - instructions: 2876049568 + instructions: 2909581163 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_64_128: total: calls: 1 - instructions: 1258690704 + instructions: 1266244412 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_8_128: total: calls: 1 - instructions: 865694095 + instructions: 890548128 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1598,133 +1598,133 @@ benches: btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 606056710 + instructions: 617365657 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: calls: 1 - instructions: 7421888863 + instructions: 7443681670 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: calls: 1 - instructions: 1635342144 + instructions: 1617345849 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: calls: 1 - instructions: 690775087 + instructions: 680931138 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: calls: 1 - instructions: 2469317746 + instructions: 2484631234 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: calls: 1 - instructions: 1018120605 + instructions: 1021483724 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: calls: 1 - instructions: 782398055 + instructions: 781915056 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: calls: 1 - instructions: 735719719 + instructions: 744574068 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 818891031 + instructions: 807337172 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: calls: 1 - instructions: 747183764 + instructions: 746891956 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 732221311 + instructions: 738999734 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: calls: 1 - instructions: 891432150 + instructions: 902919369 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: calls: 1 - instructions: 774120262 + instructions: 776453292 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 732105855 + instructions: 737909723 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: calls: 1 - instructions: 468000926 + instructions: 540380151 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: calls: 1 - instructions: 4122884697 + instructions: 4089678920 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: calls: 1 - instructions: 950218276 + instructions: 972816970 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: calls: 1 - instructions: 623528283 + instructions: 637021809 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 601729363 + instructions: 614220960 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1738,133 +1738,133 @@ benches: btreemap_v2_remove_u64_vec8: total: calls: 1 - instructions: 607719707 + instructions: 618652901 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 767231405 + instructions: 767781965 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4494007831 + instructions: 4549925111 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1460612369 + instructions: 1455674525 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 929964099 + instructions: 914352359 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2201264226 + instructions: 2238417535 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1707152362 + instructions: 1742827912 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1057250861 + instructions: 1066501637 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 891416961 + instructions: 895242939 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1273313058 + instructions: 1265629914 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 899011040 + instructions: 905583523 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 897947774 + instructions: 916039896 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1427984953 + instructions: 1453681896 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 983939968 + instructions: 961702621 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 892022422 + instructions: 910058790 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 667510837 + instructions: 748413198 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 2968225990 + instructions: 3008771332 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1188795413 + instructions: 1238605708 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 839843886 + instructions: 845380655 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/compare/canbench_results.yml b/benchmarks/compare/canbench_results.yml index f6b530a3..43102e8c 100644 --- a/benchmarks/compare/canbench_results.yml +++ b/benchmarks/compare/canbench_results.yml @@ -2,21 +2,21 @@ benches: read_chunks_btreemap_1: total: calls: 1 - instructions: 1219162536 + instructions: 1219162561 heap_increase: 3233 stable_memory_increase: 1665 scopes: {} read_chunks_btreemap_1k: total: calls: 1 - instructions: 5545655759 + instructions: 5545847609 heap_increase: 1604 stable_memory_increase: 1665 scopes: {} read_chunks_btreemap_1m: total: calls: 1 - instructions: 135388773062 + instructions: 135895194595 heap_increase: 1892 stable_memory_increase: 3201 scopes: {} @@ -44,22 +44,22 @@ benches: read_chunks_vec_1: total: calls: 1 - instructions: 1363286562 + instructions: 943855461 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1k: total: calls: 1 - instructions: 1509460903 - heap_increase: 3200 + instructions: 1088702000 + heap_increase: 1602 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1m: total: calls: 1 - instructions: 4893968831 - heap_increase: 3784 + instructions: 3932728146 + heap_increase: 1892 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1: @@ -72,14 +72,14 @@ benches: write_chunks_btreemap_1k: total: calls: 1 - instructions: 5045761922 + instructions: 5045858622 heap_increase: 1604 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1m: total: calls: 1 - instructions: 91887580509 + instructions: 92128802300 heap_increase: 1892 stable_memory_increase: 3201 scopes: {} @@ -107,22 +107,22 @@ benches: write_chunks_vec_1: total: calls: 1 - instructions: 1257791003 + instructions: 838359902 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1k: total: calls: 1 - instructions: 1402998606 - heap_increase: 3200 + instructions: 982239703 + heap_increase: 1602 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1m: total: calls: 1 - instructions: 3884427088 - heap_increase: 3784 + instructions: 2923186403 + heap_increase: 1892 stable_memory_increase: 1665 scopes: {} version: 0.1.15 diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index bd26963c..c51643f4 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -87,10 +87,7 @@ fn read_chunks_btreemap(mem_id: u8, n: usize) { fn write_chunks_vec(mem_id: u8, n: usize) { let vec: StableVec, _> = StableVec::new(init_memory(mem_id)).expect("Vec::new failed"); - let chunks: Vec<_> = chunk_data(n) - .iter() - .map(|chunk| BoundedVecN::from(chunk.as_slice())) - .collect(); + let chunks: Vec<_> = chunk_data(n).into_iter().map(BoundedVecN::from).collect(); bench_fn(|| { for chunk in &chunks { diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index c11c8350..f3210dc3 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -6,16 +6,20 @@ pub trait Random { fn random(rng: &mut Rng) -> Self; } +#[inline] fn random_bytes(rng: &mut Rng, max_size: u32) -> Vec { - let size = if max_size > 0 { - (rng.rand_u32() % max_size) as usize + let size = (rng.rand_u32() % (max_size + 1)) as usize; + if size == 0 { + Vec::new() } else { - 0 - }; - rng.iter(Rand::rand_u8).take(size).collect() + let mut buf = Vec::with_capacity(size); + buf.extend(rng.iter(Rand::rand_u8).take(size)); + buf + } } impl Random for Blob { + #[inline] fn random(rng: &mut Rng) -> Self { let bytes = random_bytes(rng, Blob::::BOUND.max_size()); Blob::try_from(&bytes[..]).unwrap() @@ -23,20 +27,23 @@ impl Random for Blob { } impl Random for UnboundedVecN { + #[inline] fn random(rng: &mut Rng) -> Self { let bytes = random_bytes(rng, Self::max_size()); - Self::from(&bytes[..]) + Self::from(bytes) } } impl Random for BoundedVecN { + #[inline] fn random(rng: &mut Rng) -> Self { let bytes = random_bytes(rng, Self::max_size()); - Self::from(&bytes[..]) + Self::from(bytes) } } impl Random for u64 { + #[inline] fn random(rng: &mut Rng) -> Self { rng.rand_u64() } diff --git a/src/storable.rs b/src/storable.rs index 8cadff1d..6e8732b7 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -200,11 +200,10 @@ impl UnboundedVecN { } } -impl From<&[u8]> for UnboundedVecN { +impl From> for UnboundedVecN { /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. - fn from(slice: &[u8]) -> Self { - let mut vec = Vec::with_capacity(N); - vec.extend_from_slice(slice); + fn from(src: Vec) -> Self { + let mut vec = src; vec.resize(N, 0); Self(vec) } @@ -239,11 +238,10 @@ impl BoundedVecN { } } -impl From<&[u8]> for BoundedVecN { +impl From> for BoundedVecN { /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. - fn from(slice: &[u8]) -> Self { - let mut vec = Vec::with_capacity(N); - vec.extend_from_slice(slice); + fn from(src: Vec) -> Self { + let mut vec = src; vec.resize(N, 0); Self(vec) } From ddd308a8cf7a62a270d211455b7f55a50ed75503 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 15:07:54 +0200 Subject: [PATCH 13/19] revert random --- benchmarks/btreemap/canbench_results.yml | 540 +++++++++++------------ benchmarks/src/common.rs | 45 +- 2 files changed, 292 insertions(+), 293 deletions(-) diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index cf64c547..f8544bab 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -9,133 +9,133 @@ benches: btreemap_v2_contains_blob8_u64: total: calls: 1 - instructions: 279569335 + instructions: 283243186 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_1024_128: total: calls: 1 - instructions: 4252090802 + instructions: 4294894392 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_128_128: total: calls: 1 - instructions: 836767629 + instructions: 840909876 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_16_128: total: calls: 1 - instructions: 298399964 + instructions: 300105736 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_256_128: total: calls: 1 - instructions: 1331409437 + instructions: 1326771401 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_1024: total: calls: 1 - instructions: 342949922 + instructions: 337445350 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_128: total: calls: 1 - instructions: 338902257 + instructions: 337242957 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_16: total: calls: 1 - instructions: 333473127 + instructions: 329500229 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_256: total: calls: 1 - instructions: 342966469 + instructions: 335682009 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_32: total: calls: 1 - instructions: 342186936 + instructions: 342487367 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_4: total: calls: 1 - instructions: 339341982 + instructions: 333741840 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_512: total: calls: 1 - instructions: 332480516 + instructions: 333192029 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_64: total: calls: 1 - instructions: 343378710 + instructions: 337617773 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_32_8: total: calls: 1 - instructions: 345447518 + instructions: 335387695 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_4_128: total: calls: 1 - instructions: 260662505 + instructions: 250355530 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_512_128: total: calls: 1 - instructions: 2311684525 + instructions: 2298434691 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_64_128: total: calls: 1 - instructions: 412874162 + instructions: 419606574 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_blob_8_128: total: calls: 1 - instructions: 274425199 + instructions: 273336147 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_u64_blob8: total: calls: 1 - instructions: 225260904 + instructions: 225499211 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -149,133 +149,133 @@ benches: btreemap_v2_contains_u64_vec8: total: calls: 1 - instructions: 224953296 + instructions: 225499211 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec8_u64: total: calls: 1 - instructions: 370675389 + instructions: 373560027 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_1024_128: total: calls: 1 - instructions: 1885377607 + instructions: 1919378451 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_128_128: total: calls: 1 - instructions: 579039587 + instructions: 578678439 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_16_128: total: calls: 1 - instructions: 437534302 + instructions: 438289696 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_256_128: total: calls: 1 - instructions: 894442266 + instructions: 886395128 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_1024: total: calls: 1 - instructions: 530472614 + instructions: 519122111 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_128: total: calls: 1 - instructions: 434280371 + instructions: 425516714 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_16: total: calls: 1 - instructions: 364842018 + instructions: 366770862 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_256: total: calls: 1 - instructions: 452917962 + instructions: 454919880 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_32: total: calls: 1 - instructions: 365391924 + instructions: 367588546 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_4: total: calls: 1 - instructions: 366781307 + instructions: 367266465 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_512: total: calls: 1 - instructions: 459219450 + instructions: 474015828 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_64: total: calls: 1 - instructions: 372710499 + instructions: 400243207 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_8: total: calls: 1 - instructions: 371552858 + instructions: 367395054 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_4_128: total: calls: 1 - instructions: 382299653 + instructions: 406206667 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_512_128: total: calls: 1 - instructions: 1250788225 + instructions: 1239428894 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_64_128: total: calls: 1 - instructions: 501846618 + instructions: 507660713 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_8_128: total: calls: 1 - instructions: 397177602 + instructions: 398406542 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -289,133 +289,133 @@ benches: btreemap_v2_get_blob8_u64: total: calls: 1 - instructions: 296412706 + instructions: 294497964 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_1024_128: total: calls: 1 - instructions: 4391175660 + instructions: 4434041253 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_128_128: total: calls: 1 - instructions: 869705084 + instructions: 874096444 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_16_128: total: calls: 1 - instructions: 311596744 + instructions: 313526179 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_256_128: total: calls: 1 - instructions: 1377810968 + instructions: 1373148630 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_1024: total: calls: 1 - instructions: 362674081 + instructions: 357155881 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_128: total: calls: 1 - instructions: 353310194 + instructions: 351535572 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_16: total: calls: 1 - instructions: 344026436 + instructions: 340461038 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_256: total: calls: 1 - instructions: 358509346 + instructions: 351061577 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_32: total: calls: 1 - instructions: 353448060 + instructions: 353942159 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_4: total: calls: 1 - instructions: 349342451 + instructions: 343418312 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_512: total: calls: 1 - instructions: 349424862 + instructions: 350194697 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_64: total: calls: 1 - instructions: 356281938 + instructions: 350423636 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_32_8: total: calls: 1 - instructions: 355327040 + instructions: 345686334 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_4_128: total: calls: 1 - instructions: 273429355 + instructions: 262413920 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_512_128: total: calls: 1 - instructions: 2389001360 + instructions: 2375697187 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_64_128: total: calls: 1 - instructions: 436454565 + instructions: 443018386 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_blob_8_128: total: calls: 1 - instructions: 287583033 + instructions: 286466150 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_u64_blob8: total: calls: 1 - instructions: 235792600 + instructions: 235941207 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -429,427 +429,427 @@ benches: btreemap_v2_get_u64_vec8: total: calls: 1 - instructions: 236162395 + instructions: 236688731 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec8_u64: total: calls: 1 - instructions: 380833850 + instructions: 383769073 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_1024_128: total: calls: 1 - instructions: 1899841865 + instructions: 1932423552 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_128_128: total: calls: 1 - instructions: 591338628 + instructions: 590909206 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_16_128: total: calls: 1 - instructions: 446767446 + instructions: 447602907 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_256_128: total: calls: 1 - instructions: 907173506 + instructions: 899177328 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_1024: total: calls: 1 - instructions: 558700232 + instructions: 542612319 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_128: total: calls: 1 - instructions: 444141723 + instructions: 435878031 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_16: total: calls: 1 - instructions: 372416012 + instructions: 374329633 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_256: total: calls: 1 - instructions: 479596965 + instructions: 474731482 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_32: total: calls: 1 - instructions: 373075356 + instructions: 375269008 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_4: total: calls: 1 - instructions: 376733864 + instructions: 377074558 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_512: total: calls: 1 - instructions: 486288823 + instructions: 493105574 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_64: total: calls: 1 - instructions: 382635141 + instructions: 409014210 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_8: total: calls: 1 - instructions: 381368135 + instructions: 377230654 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_4_128: total: calls: 1 - instructions: 391250794 + instructions: 415058958 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_512_128: total: calls: 1 - instructions: 1264637463 + instructions: 1252617345 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_64_128: total: calls: 1 - instructions: 512502419 + instructions: 518343794 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_8_128: total: calls: 1 - instructions: 406227911 + instructions: 407443377 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_10mib_values: total: calls: 1 - instructions: 5251792410 + instructions: 5258501047 heap_increase: 322 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 455947363 + instructions: 451044317 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: calls: 1 - instructions: 5523594541 + instructions: 5525792626 heap_increase: 0 - stable_memory_increase: 199 + stable_memory_increase: 196 scopes: {} btreemap_v2_insert_blob_128_128: total: calls: 1 - instructions: 1203218447 + instructions: 1208825750 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: calls: 1 - instructions: 501467725 + instructions: 500595128 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: calls: 1 - instructions: 1830073450 + instructions: 1817440974 heap_increase: 0 - stable_memory_increase: 68 + stable_memory_increase: 67 scopes: {} btreemap_v2_insert_blob_32_1024: total: calls: 1 - instructions: 725043434 + instructions: 724853356 heap_increase: 0 - stable_memory_increase: 172 + stable_memory_increase: 173 scopes: {} btreemap_v2_insert_blob_32_128: total: calls: 1 - instructions: 566142273 + instructions: 563517613 heap_increase: 0 - stable_memory_increase: 29 + stable_memory_increase: 28 scopes: {} btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 546543871 + instructions: 539415314 heap_increase: 0 - stable_memory_increase: 10 + stable_memory_increase: 11 scopes: {} btreemap_v2_insert_blob_32_256: total: calls: 1 - instructions: 593776963 + instructions: 592921822 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: calls: 1 - instructions: 552918385 + instructions: 550208733 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 534267119 + instructions: 530058347 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: calls: 1 - instructions: 638561772 + instructions: 631338519 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: calls: 1 - instructions: 561110368 + instructions: 556450257 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: calls: 1 - instructions: 540640060 + instructions: 538694836 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: calls: 1 - instructions: 443092010 + instructions: 421163069 heap_increase: 0 - stable_memory_increase: 16 + stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_512_128: total: calls: 1 - instructions: 3059129166 + instructions: 3070373313 heap_increase: 0 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: calls: 1 - instructions: 690664526 + instructions: 687228419 heap_increase: 0 - stable_memory_increase: 35 + stable_memory_increase: 34 scopes: {} btreemap_v2_insert_blob_8_128: total: calls: 1 - instructions: 474598915 + instructions: 473328702 heap_increase: 0 - stable_memory_increase: 21 + stable_memory_increase: 20 scopes: {} btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 426060715 + instructions: 424862304 heap_increase: 0 - stable_memory_increase: 6 + stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: calls: 1 - instructions: 433078328 + instructions: 433092327 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 433283181 + instructions: 432993530 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 599847919 + instructions: 596560430 heap_increase: 0 - stable_memory_increase: 17 + stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2758769053 + instructions: 2757110556 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1040490586 + instructions: 1044016862 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 721318329 + instructions: 717501290 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1427609829 + instructions: 1427124002 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1224523750 + instructions: 1222121962 heap_increase: 0 - stable_memory_increase: 172 + stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 789028402 + instructions: 782105822 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 687817166 + instructions: 688127059 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 885542609 + instructions: 885299946 heap_increase: 0 - stable_memory_increase: 55 + stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 683910327 + instructions: 684423395 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 681997994 + instructions: 681675659 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 1007210069 + instructions: 1003107393 heap_increase: 0 - stable_memory_increase: 90 + stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 721433712 + instructions: 717749403 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 684122424 + instructions: 680345030 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 649744561 + instructions: 619987423 heap_increase: 0 - stable_memory_increase: 19 + stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1896249533 + instructions: 1894593124 heap_increase: 0 - stable_memory_increase: 113 + stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 880005792 + instructions: 877903824 heap_increase: 0 - stable_memory_increase: 40 + stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 682855042 + instructions: 680625651 heap_increase: 0 - stable_memory_increase: 25 + stable_memory_increase: 23 scopes: {} btreemap_v2_mem_manager_contains_blob512_u64: total: calls: 1 - instructions: 2415717136 + instructions: 2393561731 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_contains_u64_blob512: total: calls: 1 - instructions: 300203853 + instructions: 301490930 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -863,28 +863,28 @@ benches: btreemap_v2_mem_manager_contains_u64_vec512: total: calls: 1 - instructions: 388598332 + instructions: 389757738 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_contains_vec512_u64: total: calls: 1 - instructions: 1257778723 + instructions: 1263510444 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_blob512_u64: total: calls: 1 - instructions: 2502172666 + instructions: 2480010677 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_u64_blob512: total: calls: 1 - instructions: 317655937 + instructions: 318984422 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -898,630 +898,630 @@ benches: btreemap_v2_mem_manager_get_u64_vec512: total: calls: 1 - instructions: 415844924 + instructions: 416829257 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_get_vec512_u64: total: calls: 1 - instructions: 1300334542 + instructions: 1307068580 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_blob512_u64: total: calls: 1 - instructions: 3197554675 + instructions: 3189283683 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_blob512: total: calls: 1 - instructions: 646132134 + instructions: 647090916 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_u64: total: calls: 1 - instructions: 560416018 + instructions: 560424938 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_vec512: total: calls: 1 - instructions: 904433699 + instructions: 908258262 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: calls: 1 - instructions: 2032393223 - heap_increase: 1 + instructions: 2035502486 + heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_blob512_u64: total: calls: 1 - instructions: 4341376848 + instructions: 4412188579 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_blob512: total: calls: 1 - instructions: 932100749 + instructions: 950509469 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_u64: total: calls: 1 - instructions: 808272557 + instructions: 808306277 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_vec512: total: calls: 1 - instructions: 1267125799 + instructions: 1291039851 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_vec512_u64: total: calls: 1 - instructions: 3131312791 + instructions: 3186944711 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob8_u64: total: calls: 1 - instructions: 637404895 + instructions: 622231318 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_1024_128: total: calls: 1 - instructions: 8480747187 + instructions: 8431489312 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_128_128: total: calls: 1 - instructions: 1833661013 + instructions: 1868792923 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_16_128: total: calls: 1 - instructions: 776414626 + instructions: 765979961 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: calls: 1 - instructions: 2819191495 + instructions: 2807129778 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: calls: 1 - instructions: 1151687300 + instructions: 1151789844 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: calls: 1 - instructions: 881572332 + instructions: 895275106 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_16: total: calls: 1 - instructions: 842465657 + instructions: 830182921 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_256: total: calls: 1 - instructions: 925437514 + instructions: 924011983 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_32: total: calls: 1 - instructions: 849846670 + instructions: 844943820 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_4: total: calls: 1 - instructions: 825410462 + instructions: 813450119 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_512: total: calls: 1 - instructions: 1000162337 + instructions: 988664675 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_64: total: calls: 1 - instructions: 863521416 + instructions: 853674072 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_8: total: calls: 1 - instructions: 842827911 + instructions: 831831081 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_4_128: total: calls: 1 - instructions: 473187449 + instructions: 382999265 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_512_128: total: calls: 1 - instructions: 4716328635 + instructions: 4656593150 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_64_128: total: calls: 1 - instructions: 1078455583 + instructions: 1070301815 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: calls: 1 - instructions: 660040421 + instructions: 626232852 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_blob8: total: calls: 1 - instructions: 702819873 + instructions: 704664644 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: calls: 1 - instructions: 716277147 + instructions: 716312902 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_vec8: total: calls: 1 - instructions: 702597937 + instructions: 707213350 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec8_u64: total: calls: 1 - instructions: 813651829 + instructions: 798418804 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_1024_128: total: calls: 1 - instructions: 4092222458 + instructions: 4091213598 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_128_128: total: calls: 1 - instructions: 1526831623 + instructions: 1541446928 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_16_128: total: calls: 1 - instructions: 1053741471 + instructions: 1038980187 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_256_128: total: calls: 1 - instructions: 2053487698 + instructions: 2060275875 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_1024: total: calls: 1 - instructions: 1729155939 + instructions: 1722102042 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 1110845516 + instructions: 1122055852 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_16: total: calls: 1 - instructions: 972222163 + instructions: 965015096 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_256: total: calls: 1 - instructions: 1250812350 + instructions: 1248902622 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_32: total: calls: 1 - instructions: 967928426 + instructions: 961156749 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_4: total: calls: 1 - instructions: 962873752 + instructions: 954459165 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_512: total: calls: 1 - instructions: 1417784478 + instructions: 1405305075 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_64: total: calls: 1 - instructions: 1013091366 + instructions: 1005162723 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_8: total: calls: 1 - instructions: 967302305 + instructions: 965767652 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_4_128: total: calls: 1 - instructions: 673493909 + instructions: 546679691 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_512_128: total: calls: 1 - instructions: 2784783301 + instructions: 2759030897 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_64_128: total: calls: 1 - instructions: 1269719778 + instructions: 1266647785 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_8_128: total: calls: 1 - instructions: 905541083 + instructions: 859992164 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob8_u64: total: calls: 1 - instructions: 631859405 + instructions: 602378794 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_1024_128: total: calls: 1 - instructions: 8161739568 + instructions: 8114672995 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_128_128: total: calls: 1 - instructions: 1787654636 + instructions: 1802557238 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_16_128: total: calls: 1 - instructions: 760709963 + instructions: 742010389 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: calls: 1 - instructions: 2735047433 + instructions: 2718417571 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: calls: 1 - instructions: 1127339781 + instructions: 1117680205 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: calls: 1 - instructions: 858830001 + instructions: 862740574 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_16: total: calls: 1 - instructions: 821903648 + instructions: 805615861 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_256: total: calls: 1 - instructions: 901391139 + instructions: 895500863 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_32: total: calls: 1 - instructions: 832450055 + instructions: 815546397 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_4: total: calls: 1 - instructions: 808702620 + instructions: 793651699 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_512: total: calls: 1 - instructions: 976679720 + instructions: 965235827 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_64: total: calls: 1 - instructions: 842453541 + instructions: 829958837 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_8: total: calls: 1 - instructions: 817181157 + instructions: 807345643 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_4_128: total: calls: 1 - instructions: 459896962 + instructions: 371630694 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_512_128: total: calls: 1 - instructions: 4554791885 + instructions: 4497167500 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_64_128: total: calls: 1 - instructions: 1049586965 + instructions: 1041947660 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 640092931 + instructions: 622236022 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_blob8: total: calls: 1 - instructions: 683734819 + instructions: 685772062 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: calls: 1 - instructions: 697134664 + instructions: 697171367 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_vec8: total: calls: 1 - instructions: 683739104 + instructions: 688052740 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec8_u64: total: calls: 1 - instructions: 806560393 + instructions: 775817706 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_1024_128: total: calls: 1 - instructions: 4320770299 + instructions: 4317879913 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_128_128: total: calls: 1 - instructions: 1552489406 + instructions: 1555422842 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_16_128: total: calls: 1 - instructions: 1050247309 + instructions: 1026310429 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_256_128: total: calls: 1 - instructions: 2141202369 + instructions: 2133973948 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_1024: total: calls: 1 - instructions: 1718322608 + instructions: 1704814026 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 1102680067 + instructions: 1103093155 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_16: total: calls: 1 - instructions: 958367696 + instructions: 944215477 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_256: total: calls: 1 - instructions: 1239114989 + instructions: 1231850054 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_32: total: calls: 1 - instructions: 961260413 + instructions: 943096578 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_4: total: calls: 1 - instructions: 945626469 + instructions: 940360454 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_512: total: calls: 1 - instructions: 1405148216 + instructions: 1395639342 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_64: total: calls: 1 - instructions: 996845151 + instructions: 986600435 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_8: total: calls: 1 - instructions: 949870993 + instructions: 943862484 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_4_128: total: calls: 1 - instructions: 661701806 + instructions: 536516600 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_512_128: total: calls: 1 - instructions: 2909581163 + instructions: 2878595390 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_64_128: total: calls: 1 - instructions: 1266244412 + instructions: 1259262801 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_8_128: total: calls: 1 - instructions: 890548128 + instructions: 865844850 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1591,280 +1591,280 @@ benches: btreemap_v2_remove_10mib_values: total: calls: 1 - instructions: 4737371950 + instructions: 4745633349 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 617365657 + instructions: 606088927 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: calls: 1 - instructions: 7443681670 + instructions: 7421892865 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: calls: 1 - instructions: 1617345849 + instructions: 1635346170 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: calls: 1 - instructions: 680931138 + instructions: 690778699 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: calls: 1 - instructions: 2484631234 + instructions: 2469321763 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: calls: 1 - instructions: 1021483724 + instructions: 1018124451 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: calls: 1 - instructions: 781915056 + instructions: 782401853 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: calls: 1 - instructions: 744574068 + instructions: 735723619 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 807337172 + instructions: 818894923 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: calls: 1 - instructions: 746891956 + instructions: 747187643 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 738999734 + instructions: 732225518 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: calls: 1 - instructions: 902919369 + instructions: 891436017 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: calls: 1 - instructions: 776453292 + instructions: 774124102 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 737909723 + instructions: 732109726 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: calls: 1 - instructions: 540380151 + instructions: 468003047 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: calls: 1 - instructions: 4089678920 + instructions: 4122888732 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: calls: 1 - instructions: 972816970 + instructions: 950222209 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: calls: 1 - instructions: 637021809 + instructions: 623531403 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 614220960 + instructions: 601738047 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: calls: 1 - instructions: 623942722 + instructions: 623981521 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_vec8: total: calls: 1 - instructions: 618652901 + instructions: 607723739 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 767781965 + instructions: 767004686 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4549925111 + instructions: 4563620600 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1455674525 + instructions: 1471356485 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 914352359 + instructions: 924676656 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2238417535 + instructions: 2202254601 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1742827912 + instructions: 1754432632 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1066501637 + instructions: 1060390894 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 895242939 + instructions: 891258337 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1265629914 + instructions: 1278264772 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 905583523 + instructions: 899283840 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 916039896 + instructions: 917087541 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1453681896 + instructions: 1430862331 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 961702621 + instructions: 963715588 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 910058790 + instructions: 910830769 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 748413198 + instructions: 670641556 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 3008771332 + instructions: 2985576186 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1238605708 + instructions: 1214247436 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 845380655 + instructions: 836997667 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index f3210dc3..e8d95712 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -6,39 +6,38 @@ pub trait Random { fn random(rng: &mut Rng) -> Self; } -#[inline] -fn random_bytes(rng: &mut Rng, max_size: u32) -> Vec { - let size = (rng.rand_u32() % (max_size + 1)) as usize; - if size == 0 { - Vec::new() - } else { - let mut buf = Vec::with_capacity(size); - buf.extend(rng.iter(Rand::rand_u8).take(size)); - buf - } -} - impl Random for Blob { - #[inline] fn random(rng: &mut Rng) -> Self { - let bytes = random_bytes(rng, Blob::::BOUND.max_size()); - Blob::try_from(&bytes[..]).unwrap() + let size = rng.rand_u32() % Blob::::BOUND.max_size(); + Blob::try_from( + rng.iter(Rand::rand_u8) + .take(size as usize) + .collect::>() + .as_slice(), + ) + .unwrap() } } -impl Random for UnboundedVecN { - #[inline] +impl Random for BoundedVecN { fn random(rng: &mut Rng) -> Self { - let bytes = random_bytes(rng, Self::max_size()); - Self::from(bytes) + let size = rng.rand_u32() % Self::max_size(); + let mut buf = Vec::with_capacity(size as usize); + for _ in 0..size { + buf.push(rng.rand_u8()); + } + Self::from(buf) } } -impl Random for BoundedVecN { - #[inline] +impl Random for UnboundedVecN { fn random(rng: &mut Rng) -> Self { - let bytes = random_bytes(rng, Self::max_size()); - Self::from(bytes) + let size = rng.rand_u32() % Self::max_size(); + let mut buf = Vec::with_capacity(size as usize); + for _ in 0..size { + buf.push(rng.rand_u8()); + } + Self::from(buf) } } From 8d1f2d3d516661ced193171ce4cbbf2b6fdfe71c Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 15:21:26 +0200 Subject: [PATCH 14/19] . --- benchmarks/btreemap/canbench_results.yml | 286 +++++++++++------------ benchmarks/compare/canbench_results.yml | 12 +- benchmarks/compare/src/main.rs | 5 +- benchmarks/src/common.rs | 6 +- src/storable.rs | 30 ++- 5 files changed, 175 insertions(+), 164 deletions(-) diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index f8544bab..860469fc 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -156,126 +156,126 @@ benches: btreemap_v2_contains_vec8_u64: total: calls: 1 - instructions: 373560027 + instructions: 373974679 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_1024_128: total: calls: 1 - instructions: 1919378451 + instructions: 1847543843 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_128_128: total: calls: 1 - instructions: 578678439 + instructions: 562946697 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_16_128: total: calls: 1 - instructions: 438289696 + instructions: 432781519 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_256_128: total: calls: 1 - instructions: 886395128 + instructions: 916951505 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_1024: total: calls: 1 - instructions: 519122111 + instructions: 516345708 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_128: total: calls: 1 - instructions: 425516714 + instructions: 437597039 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_16: total: calls: 1 - instructions: 366770862 + instructions: 367092396 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_256: total: calls: 1 - instructions: 454919880 + instructions: 445726845 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_32: total: calls: 1 - instructions: 367588546 + instructions: 367166163 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_4: total: calls: 1 - instructions: 367266465 + instructions: 366267458 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_512: total: calls: 1 - instructions: 474015828 + instructions: 480959847 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_64: total: calls: 1 - instructions: 400243207 + instructions: 407119037 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_32_8: total: calls: 1 - instructions: 367395054 + instructions: 366285313 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_4_128: total: calls: 1 - instructions: 406206667 + instructions: 398219523 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_512_128: total: calls: 1 - instructions: 1239428894 + instructions: 1276595171 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_64_128: total: calls: 1 - instructions: 507660713 + instructions: 512370490 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_contains_vec_8_128: total: calls: 1 - instructions: 398406542 + instructions: 398244279 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -436,140 +436,140 @@ benches: btreemap_v2_get_vec8_u64: total: calls: 1 - instructions: 383769073 + instructions: 383633031 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_1024_128: total: calls: 1 - instructions: 1932423552 + instructions: 1895892021 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_128_128: total: calls: 1 - instructions: 590909206 + instructions: 575182491 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_16_128: total: calls: 1 - instructions: 447602907 + instructions: 442328780 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_256_128: total: calls: 1 - instructions: 899177328 + instructions: 929706179 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_1024: total: calls: 1 - instructions: 542612319 + instructions: 558668778 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_128: total: calls: 1 - instructions: 435878031 + instructions: 447698379 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_16: total: calls: 1 - instructions: 374329633 + instructions: 374638992 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_256: total: calls: 1 - instructions: 474731482 + instructions: 463244749 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_32: total: calls: 1 - instructions: 375269008 + instructions: 374845455 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_4: total: calls: 1 - instructions: 377074558 + instructions: 374022129 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_512: total: calls: 1 - instructions: 493105574 + instructions: 502894640 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_64: total: calls: 1 - instructions: 409014210 + instructions: 415510238 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_32_8: total: calls: 1 - instructions: 377230654 + instructions: 374044541 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_4_128: total: calls: 1 - instructions: 415058958 + instructions: 407171466 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_512_128: total: calls: 1 - instructions: 1252617345 + instructions: 1289217055 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_64_128: total: calls: 1 - instructions: 518343794 + instructions: 523089683 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_get_vec_8_128: total: calls: 1 - instructions: 407443377 + instructions: 407684851 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_insert_10mib_values: total: calls: 1 - instructions: 5258501047 + instructions: 5253158775 heap_increase: 322 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 451044317 + instructions: 451036077 heap_increase: 0 stable_memory_increase: 4 scopes: {} @@ -618,7 +618,7 @@ benches: btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 539415314 + instructions: 539415306 heap_increase: 0 stable_memory_increase: 11 scopes: {} @@ -639,7 +639,7 @@ benches: btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 530058347 + instructions: 530058175 heap_increase: 0 stable_memory_increase: 8 scopes: {} @@ -695,147 +695,147 @@ benches: btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 424862304 + instructions: 424861284 heap_increase: 0 stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: calls: 1 - instructions: 433092327 + instructions: 433083407 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 432993530 + instructions: 433610312 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 596560430 + instructions: 596678777 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2757110556 + instructions: 2791417083 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1044016862 + instructions: 1043159724 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 717501290 + instructions: 719681386 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1427124002 + instructions: 1425341237 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1222121962 + instructions: 1245260692 heap_increase: 0 stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 782105822 + instructions: 783663888 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 688127059 + instructions: 688718372 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 885299946 + instructions: 908116143 heap_increase: 0 stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 684423395 + instructions: 684437727 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 681675659 + instructions: 683386490 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 1003107393 + instructions: 1026471009 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 717749403 + instructions: 717140226 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 680345030 + instructions: 682699621 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 619987423 + instructions: 621410307 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1894593124 + instructions: 1903038099 heap_increase: 0 stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 877903824 + instructions: 874491086 heap_increase: 0 stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 680625651 + instructions: 680550601 heap_increase: 0 stable_memory_increase: 23 scopes: {} @@ -870,7 +870,7 @@ benches: btreemap_v2_mem_manager_contains_vec512_u64: total: calls: 1 - instructions: 1263510444 + instructions: 1263289436 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -905,14 +905,14 @@ benches: btreemap_v2_mem_manager_get_vec512_u64: total: calls: 1 - instructions: 1307068580 + instructions: 1307093929 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_blob512_u64: total: calls: 1 - instructions: 3189283683 + instructions: 3189283499 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -926,63 +926,63 @@ benches: btreemap_v2_mem_manager_insert_u64_u64: total: calls: 1 - instructions: 560424938 + instructions: 560416018 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_u64_vec512: total: calls: 1 - instructions: 908258262 + instructions: 900560613 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_insert_vec512_u64: total: calls: 1 - instructions: 2035502486 + instructions: 2032213941 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_blob512_u64: total: calls: 1 - instructions: 4412188579 + instructions: 4412188235 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_blob512: total: calls: 1 - instructions: 950509469 + instructions: 950509465 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_u64: total: calls: 1 - instructions: 808306277 + instructions: 808272557 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_u64_vec512: total: calls: 1 - instructions: 1291039851 + instructions: 1289646675 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_mem_manager_remove_vec512_u64: total: calls: 1 - instructions: 3186944711 + instructions: 3183910603 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob8_u64: total: calls: 1 - instructions: 622231318 + instructions: 622204734 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1003,7 +1003,7 @@ benches: btreemap_v2_pop_first_blob_16_128: total: calls: 1 - instructions: 765979961 + instructions: 765979957 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1031,7 +1031,7 @@ benches: btreemap_v2_pop_first_blob_32_16: total: calls: 1 - instructions: 830182921 + instructions: 830182917 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1052,7 +1052,7 @@ benches: btreemap_v2_pop_first_blob_32_4: total: calls: 1 - instructions: 813450119 + instructions: 813449743 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1073,7 +1073,7 @@ benches: btreemap_v2_pop_first_blob_32_8: total: calls: 1 - instructions: 831831081 + instructions: 831831033 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1087,7 +1087,7 @@ benches: btreemap_v2_pop_first_blob_512_128: total: calls: 1 - instructions: 4656593150 + instructions: 4656593142 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1108,14 +1108,14 @@ benches: btreemap_v2_pop_first_u64_blob8: total: calls: 1 - instructions: 704664644 + instructions: 704660792 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: calls: 1 - instructions: 716312902 + instructions: 716282226 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1136,42 +1136,42 @@ benches: btreemap_v2_pop_first_vec_1024_128: total: calls: 1 - instructions: 4091213598 + instructions: 4088244642 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_128_128: total: calls: 1 - instructions: 1541446928 + instructions: 1540253392 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_16_128: total: calls: 1 - instructions: 1038980187 + instructions: 1038792519 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_256_128: total: calls: 1 - instructions: 2060275875 + instructions: 2058316631 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_1024: total: calls: 1 - instructions: 1722102042 + instructions: 1720509338 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 1122055852 + instructions: 1121758275 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1185,7 +1185,7 @@ benches: btreemap_v2_pop_first_vec_32_256: total: calls: 1 - instructions: 1248902622 + instructions: 1248161922 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1199,63 +1199,63 @@ benches: btreemap_v2_pop_first_vec_32_4: total: calls: 1 - instructions: 954459165 + instructions: 954459180 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_512: total: calls: 1 - instructions: 1405305075 + instructions: 1404192531 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_64: total: calls: 1 - instructions: 1005162723 + instructions: 1005121403 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_8: total: calls: 1 - instructions: 965767652 + instructions: 965767637 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_4_128: total: calls: 1 - instructions: 546679691 + instructions: 546605679 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_512_128: total: calls: 1 - instructions: 2759030897 + instructions: 2756539701 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_64_128: total: calls: 1 - instructions: 1266647785 + instructions: 1266113581 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_8_128: total: calls: 1 - instructions: 859992164 + instructions: 859852051 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob8_u64: total: calls: 1 - instructions: 602378794 + instructions: 602351174 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1325,7 +1325,7 @@ benches: btreemap_v2_pop_last_blob_32_4: total: calls: 1 - instructions: 793651699 + instructions: 793651203 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1346,7 +1346,7 @@ benches: btreemap_v2_pop_last_blob_32_8: total: calls: 1 - instructions: 807345643 + instructions: 807345599 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1374,77 +1374,77 @@ benches: btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 622236022 + instructions: 622236018 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_blob8: total: calls: 1 - instructions: 685772062 + instructions: 685767698 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: calls: 1 - instructions: 697171367 + instructions: 697139743 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_vec8: total: calls: 1 - instructions: 688052740 + instructions: 688052725 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec8_u64: total: calls: 1 - instructions: 775817706 + instructions: 775817721 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_1024_128: total: calls: 1 - instructions: 4317879913 + instructions: 4314905725 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_128_128: total: calls: 1 - instructions: 1555422842 + instructions: 1554225722 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_16_128: total: calls: 1 - instructions: 1026310429 + instructions: 1026121784 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_256_128: total: calls: 1 - instructions: 2133973948 + instructions: 2132015032 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_1024: total: calls: 1 - instructions: 1704814026 + instructions: 1703222226 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 1103093155 + instructions: 1102793670 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1458,7 +1458,7 @@ benches: btreemap_v2_pop_last_vec_32_256: total: calls: 1 - instructions: 1231850054 + instructions: 1231109358 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1472,56 +1472,56 @@ benches: btreemap_v2_pop_last_vec_32_4: total: calls: 1 - instructions: 940360454 + instructions: 940360469 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_512: total: calls: 1 - instructions: 1395639342 + instructions: 1394528342 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_64: total: calls: 1 - instructions: 986600435 + instructions: 986558059 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_8: total: calls: 1 - instructions: 943862484 + instructions: 943862469 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_4_128: total: calls: 1 - instructions: 536516600 + instructions: 536444584 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_512_128: total: calls: 1 - instructions: 2878595390 + instructions: 2876103010 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_64_128: total: calls: 1 - instructions: 1259262801 + instructions: 1258730445 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_8_128: total: calls: 1 - instructions: 865844850 + instructions: 865704778 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1591,14 +1591,14 @@ benches: btreemap_v2_remove_10mib_values: total: calls: 1 - instructions: 4745633349 + instructions: 4738924633 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 606088927 + instructions: 606060883 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1654,7 +1654,7 @@ benches: btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 818894923 + instructions: 818894907 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1668,7 +1668,7 @@ benches: btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 732225518 + instructions: 732225250 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1689,7 +1689,7 @@ benches: btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 732109726 + instructions: 732109674 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1724,14 +1724,14 @@ benches: btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 601738047 + instructions: 601734235 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: calls: 1 - instructions: 623981521 + instructions: 623947801 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1745,126 +1745,126 @@ benches: btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 767004686 + instructions: 767234531 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4563620600 + instructions: 4558379137 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1471356485 + instructions: 1461644794 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 924676656 + instructions: 929203207 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2202254601 + instructions: 2290550760 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1754432632 + instructions: 1731794141 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1060390894 + instructions: 1068597444 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 891258337 + instructions: 891430298 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1278264772 + instructions: 1279143183 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 899283840 + instructions: 898891401 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 917087541 + instructions: 897965941 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1430862331 + instructions: 1444031754 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 963715588 + instructions: 979418207 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 910830769 + instructions: 892017156 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 670641556 + instructions: 669124240 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 2985576186 + instructions: 3127449181 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1214247436 + instructions: 1188831359 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 836997667 + instructions: 837953416 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/compare/canbench_results.yml b/benchmarks/compare/canbench_results.yml index 43102e8c..82450aed 100644 --- a/benchmarks/compare/canbench_results.yml +++ b/benchmarks/compare/canbench_results.yml @@ -44,21 +44,21 @@ benches: read_chunks_vec_1: total: calls: 1 - instructions: 943855461 + instructions: 1363286685 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1k: total: calls: 1 - instructions: 1088702000 + instructions: 1508997783 heap_increase: 1602 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1m: total: calls: 1 - instructions: 3932728146 + instructions: 4697397902 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} @@ -107,21 +107,21 @@ benches: write_chunks_vec_1: total: calls: 1 - instructions: 838359902 + instructions: 1257791126 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1k: total: calls: 1 - instructions: 982239703 + instructions: 1402535486 heap_increase: 1602 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1m: total: calls: 1 - instructions: 2923186403 + instructions: 3687856159 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index c51643f4..3b2478a8 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -87,7 +87,10 @@ fn read_chunks_btreemap(mem_id: u8, n: usize) { fn write_chunks_vec(mem_id: u8, n: usize) { let vec: StableVec, _> = StableVec::new(init_memory(mem_id)).expect("Vec::new failed"); - let chunks: Vec<_> = chunk_data(n).into_iter().map(BoundedVecN::from).collect(); + let chunks: Vec<_> = chunk_data(n) + .into_iter() + .map(|chunk| BoundedVecN::from(&chunk)) + .collect(); bench_fn(|| { for chunk in &chunks { diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index e8d95712..a6dd3cbc 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -1,5 +1,5 @@ use ic_stable_structures::storable::{Blob, BoundedVecN, Storable, UnboundedVecN}; -use std::convert::{From, TryFrom}; +use std::convert::TryFrom; use tiny_rng::{Rand, Rng}; pub trait Random { @@ -26,7 +26,7 @@ impl Random for BoundedVecN { for _ in 0..size { buf.push(rng.rand_u8()); } - Self::from(buf) + Self::from(&buf) } } @@ -37,7 +37,7 @@ impl Random for UnboundedVecN { for _ in 0..size { buf.push(rng.rand_u8()); } - Self::from(buf) + Self::from(&buf) } } diff --git a/src/storable.rs b/src/storable.rs index 6e8732b7..c6a2a8d7 100644 --- a/src/storable.rs +++ b/src/storable.rs @@ -1,7 +1,7 @@ use ic_principal::Principal; use std::borrow::{Borrow, Cow}; use std::cmp::{Ordering, Reverse}; -use std::convert::{From, TryFrom, TryInto}; +use std::convert::{TryFrom, TryInto}; use std::fmt; mod tuples; @@ -198,12 +198,16 @@ impl UnboundedVecN { pub fn max_size() -> u32 { N as u32 } -} -impl From> for UnboundedVecN { - /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. - fn from(src: Vec) -> Self { - let mut vec = src; + pub fn from(slice: &[u8]) -> Self { + assert!( + slice.len() <= N, + "expected a slice with length <= {} bytes, but found {} bytes", + N, + slice.len() + ); + let mut vec = Vec::with_capacity(N); + vec.extend_from_slice(slice); vec.resize(N, 0); Self(vec) } @@ -236,12 +240,16 @@ impl BoundedVecN { pub fn max_size() -> u32 { N as u32 } -} -impl From> for BoundedVecN { - /// Returns a vector of length `N`, filled with the slice prefix and padded with zeros. - fn from(src: Vec) -> Self { - let mut vec = src; + pub fn from(slice: &[u8]) -> Self { + assert!( + slice.len() <= N, + "expected a slice with length <= {} bytes, but found {} bytes", + N, + slice.len() + ); + let mut vec = Vec::with_capacity(N); + vec.extend_from_slice(slice); vec.resize(N, 0); Self(vec) } From d5a4464b76c1f037f179261ed3437670318f2d01 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 15:22:21 +0200 Subject: [PATCH 15/19] . --- benchmarks/src/common.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index a6dd3cbc..b07c0b89 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -19,7 +19,7 @@ impl Random for Blob { } } -impl Random for BoundedVecN { +impl Random for UnboundedVecN { fn random(rng: &mut Rng) -> Self { let size = rng.rand_u32() % Self::max_size(); let mut buf = Vec::with_capacity(size as usize); @@ -30,7 +30,7 @@ impl Random for BoundedVecN { } } -impl Random for UnboundedVecN { +impl Random for BoundedVecN { fn random(rng: &mut Rng) -> Self { let size = rng.rand_u32() % Self::max_size(); let mut buf = Vec::with_capacity(size as usize); From b536d1f4617d1ed1f9f086af92a25b0204e57486 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 15:37:28 +0200 Subject: [PATCH 16/19] . --- benchmarks/btreemap/canbench_results.yml | 316 +++++++++++------------ benchmarks/compare/src/main.rs | 1 - benchmarks/src/common.rs | 1 - 3 files changed, 158 insertions(+), 160 deletions(-) diff --git a/benchmarks/btreemap/canbench_results.yml b/benchmarks/btreemap/canbench_results.yml index 860469fc..6abd993b 100644 --- a/benchmarks/btreemap/canbench_results.yml +++ b/benchmarks/btreemap/canbench_results.yml @@ -562,280 +562,280 @@ benches: btreemap_v2_insert_10mib_values: total: calls: 1 - instructions: 5253158775 + instructions: 5251792410 heap_increase: 322 stable_memory_increase: 3613 scopes: {} btreemap_v2_insert_blob8_u64: total: calls: 1 - instructions: 451036077 + instructions: 451032102 heap_increase: 0 stable_memory_increase: 4 scopes: {} btreemap_v2_insert_blob_1024_128: total: calls: 1 - instructions: 5525792626 + instructions: 5525788624 heap_increase: 0 stable_memory_increase: 196 scopes: {} btreemap_v2_insert_blob_128_128: total: calls: 1 - instructions: 1208825750 + instructions: 1208821724 heap_increase: 0 stable_memory_increase: 46 scopes: {} btreemap_v2_insert_blob_16_128: total: calls: 1 - instructions: 500595128 + instructions: 500591510 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_blob_256_128: total: calls: 1 - instructions: 1817440974 + instructions: 1817436957 heap_increase: 0 stable_memory_increase: 67 scopes: {} btreemap_v2_insert_blob_32_1024: total: calls: 1 - instructions: 724853356 + instructions: 724849516 heap_increase: 0 stable_memory_increase: 173 scopes: {} btreemap_v2_insert_blob_32_128: total: calls: 1 - instructions: 563517613 + instructions: 563513821 heap_increase: 0 stable_memory_increase: 28 scopes: {} btreemap_v2_insert_blob_32_16: total: calls: 1 - instructions: 539415306 + instructions: 539411394 heap_increase: 0 stable_memory_increase: 11 scopes: {} btreemap_v2_insert_blob_32_256: total: calls: 1 - instructions: 592921822 + instructions: 592917952 heap_increase: 0 stable_memory_increase: 49 scopes: {} btreemap_v2_insert_blob_32_32: total: calls: 1 - instructions: 550208733 + instructions: 550204854 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_32_4: total: calls: 1 - instructions: 530058175 + instructions: 530054248 heap_increase: 0 stable_memory_increase: 8 scopes: {} btreemap_v2_insert_blob_32_512: total: calls: 1 - instructions: 631338519 + instructions: 631334646 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_blob_32_64: total: calls: 1 - instructions: 556450257 + instructions: 556446417 heap_increase: 0 stable_memory_increase: 18 scopes: {} btreemap_v2_insert_blob_32_8: total: calls: 1 - instructions: 538694836 + instructions: 538691053 heap_increase: 0 stable_memory_increase: 9 scopes: {} btreemap_v2_insert_blob_4_128: total: calls: 1 - instructions: 421163069 + instructions: 421160972 heap_increase: 0 stable_memory_increase: 13 scopes: {} btreemap_v2_insert_blob_512_128: total: calls: 1 - instructions: 3070373313 + instructions: 3070369278 heap_increase: 0 stable_memory_increase: 111 scopes: {} btreemap_v2_insert_blob_64_128: total: calls: 1 - instructions: 687228419 + instructions: 687224486 heap_increase: 0 stable_memory_increase: 34 scopes: {} btreemap_v2_insert_blob_8_128: total: calls: 1 - instructions: 473328702 + instructions: 473325576 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_u64_blob8: total: calls: 1 - instructions: 424861284 + instructions: 424856496 heap_increase: 0 stable_memory_increase: 5 scopes: {} btreemap_v2_insert_u64_u64: total: calls: 1 - instructions: 433083407 + instructions: 433078328 heap_increase: 0 stable_memory_increase: 6 scopes: {} btreemap_v2_insert_u64_vec8: total: calls: 1 - instructions: 433610312 + instructions: 433606280 heap_increase: 0 stable_memory_increase: 21 scopes: {} btreemap_v2_insert_vec8_u64: total: calls: 1 - instructions: 596678777 + instructions: 596675651 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_1024_128: total: calls: 1 - instructions: 2791417083 + instructions: 2791324761 heap_increase: 0 stable_memory_increase: 193 scopes: {} btreemap_v2_insert_vec_128_128: total: calls: 1 - instructions: 1043159724 + instructions: 1043141925 heap_increase: 0 stable_memory_increase: 51 scopes: {} btreemap_v2_insert_vec_16_128: total: calls: 1 - instructions: 719681386 + instructions: 719668309 heap_increase: 0 stable_memory_increase: 31 scopes: {} btreemap_v2_insert_vec_256_128: total: calls: 1 - instructions: 1425341237 + instructions: 1425303710 heap_increase: 0 stable_memory_increase: 71 scopes: {} btreemap_v2_insert_vec_32_1024: total: calls: 1 - instructions: 1245260692 + instructions: 1245182314 heap_increase: 0 stable_memory_increase: 171 scopes: {} btreemap_v2_insert_vec_32_128: total: calls: 1 - instructions: 783663888 + instructions: 783650019 heap_increase: 0 stable_memory_increase: 33 scopes: {} btreemap_v2_insert_vec_32_16: total: calls: 1 - instructions: 688718372 + instructions: 688714475 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_256: total: calls: 1 - instructions: 908116143 + instructions: 908090400 heap_increase: 0 stable_memory_increase: 54 scopes: {} btreemap_v2_insert_vec_32_32: total: calls: 1 - instructions: 684437727 + instructions: 684433848 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_4: total: calls: 1 - instructions: 683386490 + instructions: 683382635 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_32_512: total: calls: 1 - instructions: 1026471009 + instructions: 1026429798 heap_increase: 0 stable_memory_increase: 91 scopes: {} btreemap_v2_insert_vec_32_64: total: calls: 1 - instructions: 717140226 + instructions: 717127989 heap_increase: 0 stable_memory_increase: 24 scopes: {} btreemap_v2_insert_vec_32_8: total: calls: 1 - instructions: 682699621 + instructions: 682695838 heap_increase: 0 stable_memory_increase: 20 scopes: {} btreemap_v2_insert_vec_4_128: total: calls: 1 - instructions: 621410307 + instructions: 621403101 heap_increase: 0 stable_memory_increase: 16 scopes: {} btreemap_v2_insert_vec_512_128: total: calls: 1 - instructions: 1903038099 + instructions: 1902984657 heap_increase: 0 stable_memory_increase: 112 scopes: {} btreemap_v2_insert_vec_64_128: total: calls: 1 - instructions: 874491086 + instructions: 874468583 heap_increase: 0 stable_memory_increase: 41 scopes: {} btreemap_v2_insert_vec_8_128: total: calls: 1 - instructions: 680550601 + instructions: 680539918 heap_increase: 0 stable_memory_increase: 23 scopes: {} @@ -982,546 +982,546 @@ benches: btreemap_v2_pop_first_blob8_u64: total: calls: 1 - instructions: 622204734 + instructions: 622200615 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_1024_128: total: calls: 1 - instructions: 8431489312 + instructions: 8431485310 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_128_128: total: calls: 1 - instructions: 1868792923 + instructions: 1868788897 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_16_128: total: calls: 1 - instructions: 765979957 + instructions: 765976333 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_256_128: total: calls: 1 - instructions: 2807129778 + instructions: 2807125761 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_1024: total: calls: 1 - instructions: 1151789844 + instructions: 1151786004 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_128: total: calls: 1 - instructions: 895275106 + instructions: 895271314 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_16: total: calls: 1 - instructions: 830182917 + instructions: 830179005 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_256: total: calls: 1 - instructions: 924011983 + instructions: 924008113 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_32: total: calls: 1 - instructions: 844943820 + instructions: 844939941 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_4: total: calls: 1 - instructions: 813449743 + instructions: 813445762 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_512: total: calls: 1 - instructions: 988664675 + instructions: 988660808 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_64: total: calls: 1 - instructions: 853674072 + instructions: 853670232 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_32_8: total: calls: 1 - instructions: 831831033 + instructions: 831827208 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_4_128: total: calls: 1 - instructions: 382999265 + instructions: 382997168 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_512_128: total: calls: 1 - instructions: 4656593142 + instructions: 4656589101 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_64_128: total: calls: 1 - instructions: 1070301815 + instructions: 1070297882 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_blob_8_128: total: calls: 1 - instructions: 626232852 + instructions: 626229708 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_blob8: total: calls: 1 - instructions: 704660792 + instructions: 704655932 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_u64: total: calls: 1 - instructions: 716282226 + instructions: 716277147 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_u64_vec8: total: calls: 1 - instructions: 707213350 + instructions: 707209318 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec8_u64: total: calls: 1 - instructions: 798418804 + instructions: 798415678 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_1024_128: total: calls: 1 - instructions: 4088244642 + instructions: 4088132406 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_128_128: total: calls: 1 - instructions: 1540253392 + instructions: 1540235593 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_16_128: total: calls: 1 - instructions: 1038792519 + instructions: 1038779442 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_256_128: total: calls: 1 - instructions: 2058316631 + instructions: 2058259562 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_1024: total: calls: 1 - instructions: 1720509338 + instructions: 1720412114 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_128: total: calls: 1 - instructions: 1121758275 + instructions: 1121742438 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_16: total: calls: 1 - instructions: 965015096 + instructions: 965011199 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_256: total: calls: 1 - instructions: 1248161922 + instructions: 1248136179 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_32: total: calls: 1 - instructions: 961156749 + instructions: 961152870 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_4: total: calls: 1 - instructions: 954459180 + instructions: 954455325 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_512: total: calls: 1 - instructions: 1404192531 + instructions: 1404132606 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_64: total: calls: 1 - instructions: 1005121403 + instructions: 1005109166 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_32_8: total: calls: 1 - instructions: 965767637 + instructions: 965763854 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_4_128: total: calls: 1 - instructions: 546605679 + instructions: 546598473 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_512_128: total: calls: 1 - instructions: 2756539701 + instructions: 2756486259 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_64_128: total: calls: 1 - instructions: 1266113581 + instructions: 1266073864 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_first_vec_8_128: total: calls: 1 - instructions: 859852051 + instructions: 859841368 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob8_u64: total: calls: 1 - instructions: 602351174 + instructions: 602347043 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_1024_128: total: calls: 1 - instructions: 8114672995 + instructions: 8114668993 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_128_128: total: calls: 1 - instructions: 1802557238 + instructions: 1802553212 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_16_128: total: calls: 1 - instructions: 742010389 + instructions: 742006771 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_256_128: total: calls: 1 - instructions: 2718417571 + instructions: 2718413554 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_1024: total: calls: 1 - instructions: 1117680205 + instructions: 1117676359 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_128: total: calls: 1 - instructions: 862740574 + instructions: 862736782 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_16: total: calls: 1 - instructions: 805615861 + instructions: 805611949 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_256: total: calls: 1 - instructions: 895500863 + instructions: 895496993 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_32: total: calls: 1 - instructions: 815546397 + instructions: 815542518 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_4: total: calls: 1 - instructions: 793651203 + instructions: 793647234 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_512: total: calls: 1 - instructions: 965235827 + instructions: 965231966 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_64: total: calls: 1 - instructions: 829958837 + instructions: 829954997 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_32_8: total: calls: 1 - instructions: 807345599 + instructions: 807341792 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_4_128: total: calls: 1 - instructions: 371630694 + instructions: 371628597 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_512_128: total: calls: 1 - instructions: 4497167500 + instructions: 4497163453 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_64_128: total: calls: 1 - instructions: 1041947660 + instructions: 1041943727 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_blob_8_128: total: calls: 1 - instructions: 622236018 + instructions: 622232886 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_blob8: total: calls: 1 - instructions: 685767698 + instructions: 685762802 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_u64: total: calls: 1 - instructions: 697139743 + instructions: 697134664 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_u64_vec8: total: calls: 1 - instructions: 688052725 + instructions: 688048693 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec8_u64: total: calls: 1 - instructions: 775817721 + instructions: 775814595 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_1024_128: total: calls: 1 - instructions: 4314905725 + instructions: 4314793483 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_128_128: total: calls: 1 - instructions: 1554225722 + instructions: 1554207923 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_16_128: total: calls: 1 - instructions: 1026121784 + instructions: 1026108707 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_256_128: total: calls: 1 - instructions: 2132015032 + instructions: 2131957975 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_1024: total: calls: 1 - instructions: 1703222226 + instructions: 1703124978 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_128: total: calls: 1 - instructions: 1102793670 + instructions: 1102777839 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_16: total: calls: 1 - instructions: 944215477 + instructions: 944211580 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_256: total: calls: 1 - instructions: 1231109358 + instructions: 1231083615 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_32: total: calls: 1 - instructions: 943096578 + instructions: 943092699 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_4: total: calls: 1 - instructions: 940360469 + instructions: 940356614 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_512: total: calls: 1 - instructions: 1394528342 + instructions: 1394468405 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_64: total: calls: 1 - instructions: 986558059 + instructions: 986545822 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_32_8: total: calls: 1 - instructions: 943862469 + instructions: 943858686 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_4_128: total: calls: 1 - instructions: 536444584 + instructions: 536437378 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_512_128: total: calls: 1 - instructions: 2876103010 + instructions: 2876049568 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_64_128: total: calls: 1 - instructions: 1258730445 + instructions: 1258690704 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_pop_last_vec_8_128: total: calls: 1 - instructions: 865704778 + instructions: 865694095 heap_increase: 0 stable_memory_increase: 0 scopes: {} @@ -1591,280 +1591,280 @@ benches: btreemap_v2_remove_10mib_values: total: calls: 1 - instructions: 4738924633 + instructions: 4737371950 heap_increase: 0 stable_memory_increase: 657 scopes: {} btreemap_v2_remove_blob8_u64: total: calls: 1 - instructions: 606060883 + instructions: 606056710 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_1024_128: total: calls: 1 - instructions: 7421892865 + instructions: 7421888863 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_128_128: total: calls: 1 - instructions: 1635346170 + instructions: 1635342144 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_16_128: total: calls: 1 - instructions: 690778699 + instructions: 690775087 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_256_128: total: calls: 1 - instructions: 2469321763 + instructions: 2469317746 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_1024: total: calls: 1 - instructions: 1018124451 + instructions: 1018120605 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_128: total: calls: 1 - instructions: 782401853 + instructions: 782398055 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_16: total: calls: 1 - instructions: 735723619 + instructions: 735719719 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_256: total: calls: 1 - instructions: 818894907 + instructions: 818891031 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_32: total: calls: 1 - instructions: 747187643 + instructions: 747183764 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_4: total: calls: 1 - instructions: 732225250 + instructions: 732221311 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_512: total: calls: 1 - instructions: 891436017 + instructions: 891432150 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_64: total: calls: 1 - instructions: 774124102 + instructions: 774120262 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_32_8: total: calls: 1 - instructions: 732109674 + instructions: 732105855 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_4_128: total: calls: 1 - instructions: 468003047 + instructions: 468000926 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_512_128: total: calls: 1 - instructions: 4122888732 + instructions: 4122884697 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_64_128: total: calls: 1 - instructions: 950222209 + instructions: 950218276 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_blob_8_128: total: calls: 1 - instructions: 623531403 + instructions: 623528283 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_blob8: total: calls: 1 - instructions: 601734235 + instructions: 601729363 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_u64: total: calls: 1 - instructions: 623947801 + instructions: 623942722 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_u64_vec8: total: calls: 1 - instructions: 607723739 + instructions: 607719707 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec8_u64: total: calls: 1 - instructions: 767234531 + instructions: 767231405 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_1024_128: total: calls: 1 - instructions: 4558379137 + instructions: 4558259611 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_128_128: total: calls: 1 - instructions: 1461644794 + instructions: 1461626995 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_16_128: total: calls: 1 - instructions: 929203207 + instructions: 929190130 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_256_128: total: calls: 1 - instructions: 2290550760 + instructions: 2290487523 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_1024: total: calls: 1 - instructions: 1731794141 + instructions: 1731690539 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_128: total: calls: 1 - instructions: 1068597444 + instructions: 1068571017 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_16: total: calls: 1 - instructions: 891430298 + instructions: 891426401 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_256: total: calls: 1 - instructions: 1279143183 + instructions: 1279117440 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_32: total: calls: 1 - instructions: 898891401 + instructions: 898887522 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_4: total: calls: 1 - instructions: 897965941 + instructions: 897962086 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_512: total: calls: 1 - instructions: 1444031754 + instructions: 1443964173 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_64: total: calls: 1 - instructions: 979418207 + instructions: 979405970 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_32_8: total: calls: 1 - instructions: 892017156 + instructions: 892013373 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_4_128: total: calls: 1 - instructions: 669124240 + instructions: 669117034 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_512_128: total: calls: 1 - instructions: 3127449181 + instructions: 3127395739 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_64_128: total: calls: 1 - instructions: 1188831359 + instructions: 1188794438 heap_increase: 0 stable_memory_increase: 0 scopes: {} btreemap_v2_remove_vec_8_128: total: calls: 1 - instructions: 837953416 + instructions: 837942733 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index 3b2478a8..dd7a4e4c 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -5,7 +5,6 @@ use ic_stable_structures::{ storable::BoundedVecN, BTreeMap, DefaultMemoryImpl, Memory, Vec as StableVec, }; -use std::convert::From; const TOTAL_SIZE: usize = 100 * 1024 * 1024; // 100 MiB const K: usize = 1_000; diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index b07c0b89..cbb6fad1 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -42,7 +42,6 @@ impl Random for BoundedVecN { } impl Random for u64 { - #[inline] fn random(rng: &mut Rng) -> Self { rng.rand_u64() } From 5a05220e13948e2b193de340e9f75a91edb4105f Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 15:43:53 +0200 Subject: [PATCH 17/19] . --- benchmarks/src/common.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/benchmarks/src/common.rs b/benchmarks/src/common.rs index cbb6fad1..5e283acd 100644 --- a/benchmarks/src/common.rs +++ b/benchmarks/src/common.rs @@ -1,5 +1,4 @@ use ic_stable_structures::storable::{Blob, BoundedVecN, Storable, UnboundedVecN}; -use std::convert::TryFrom; use tiny_rng::{Rand, Rng}; pub trait Random { From 998c9b32e99101e81ac29825ab94017f8db99f4c Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 18:11:35 +0200 Subject: [PATCH 18/19] . --- benchmarks/compare/canbench_results.yml | 36 ++++++++++++------------- benchmarks/compare/src/main.rs | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/benchmarks/compare/canbench_results.yml b/benchmarks/compare/canbench_results.yml index 82450aed..add6fc9e 100644 --- a/benchmarks/compare/canbench_results.yml +++ b/benchmarks/compare/canbench_results.yml @@ -2,126 +2,126 @@ benches: read_chunks_btreemap_1: total: calls: 1 - instructions: 1219162561 + instructions: 1219162597 heap_increase: 3233 stable_memory_increase: 1665 scopes: {} read_chunks_btreemap_1k: total: calls: 1 - instructions: 5545847609 + instructions: 5414908676 heap_increase: 1604 stable_memory_increase: 1665 scopes: {} read_chunks_btreemap_1m: total: calls: 1 - instructions: 135895194595 + instructions: 133588820086 heap_increase: 1892 stable_memory_increase: 3201 scopes: {} read_chunks_stable_1: total: calls: 1 - instructions: 812767528 + instructions: 812767514 heap_increase: 1601 stable_memory_increase: 1665 scopes: {} read_chunks_stable_1k: total: calls: 1 - instructions: 656864785 + instructions: 525926853 heap_increase: 1600 stable_memory_increase: 1665 scopes: {} read_chunks_stable_1m: total: calls: 1 - instructions: 1431625779 + instructions: 1307625987 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1: total: calls: 1 - instructions: 1363286685 + instructions: 1363286727 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1k: total: calls: 1 - instructions: 1508997783 + instructions: 1378054827 heap_increase: 1602 stable_memory_increase: 1665 scopes: {} read_chunks_vec_1m: total: calls: 1 - instructions: 4697397902 + instructions: 4584728190 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1: total: calls: 1 - instructions: 1069803013 + instructions: 1069803049 heap_increase: 3233 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1k: total: calls: 1 - instructions: 5045858622 + instructions: 4914919689 heap_increase: 1604 stable_memory_increase: 1665 scopes: {} write_chunks_btreemap_1m: total: calls: 1 - instructions: 92128802300 + instructions: 89822427791 heap_increase: 1892 stable_memory_increase: 3201 scopes: {} write_chunks_stable_1: total: calls: 1 - instructions: 418914623 + instructions: 418914609 heap_increase: 1601 stable_memory_increase: 1665 scopes: {} write_chunks_stable_1k: total: calls: 1 - instructions: 550955283 + instructions: 420017351 heap_increase: 1600 stable_memory_increase: 1665 scopes: {} write_chunks_stable_1m: total: calls: 1 - instructions: 1200987424 + instructions: 1076987632 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1: total: calls: 1 - instructions: 1257791126 + instructions: 1257791168 heap_increase: 3202 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1k: total: calls: 1 - instructions: 1402535486 + instructions: 1271592530 heap_increase: 1602 stable_memory_increase: 1665 scopes: {} write_chunks_vec_1m: total: calls: 1 - instructions: 3687856159 + instructions: 3575186447 heap_increase: 1892 stable_memory_increase: 1665 scopes: {} diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index dd7a4e4c..41b32966 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -27,7 +27,7 @@ const fn chunk_size() -> usize { fn chunk_data(n: usize) -> Vec> { let chunk_size = TOTAL_SIZE / n; - vec![vec![37; chunk_size]; n] + (0..n).map(|_| vec![37; chunk_size]).collect() } // Stable Memory benchmarks From ff055ad611f26673a759fc6a486d37ba7f7a8c48 Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Tue, 27 May 2025 18:31:59 +0200 Subject: [PATCH 19/19] . --- benchmarks/compare/src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/benchmarks/compare/src/main.rs b/benchmarks/compare/src/main.rs index 41b32966..310a3dc4 100644 --- a/benchmarks/compare/src/main.rs +++ b/benchmarks/compare/src/main.rs @@ -86,10 +86,7 @@ fn read_chunks_btreemap(mem_id: u8, n: usize) { fn write_chunks_vec(mem_id: u8, n: usize) { let vec: StableVec, _> = StableVec::new(init_memory(mem_id)).expect("Vec::new failed"); - let chunks: Vec<_> = chunk_data(n) - .into_iter() - .map(|chunk| BoundedVecN::from(&chunk)) - .collect(); + let chunks: Vec<_> = chunk_data(n).iter().map(|v| BoundedVecN::from(v)).collect(); bench_fn(|| { for chunk in &chunks {