diff --git a/collections/perf.sh b/collections/perf.sh index 128343fc..a66101a0 100644 --- a/collections/perf.sh +++ b/collections/perf.sh @@ -22,7 +22,7 @@ let vector_rs = wasm_profiling("rust/.dfx/local/canisters/vector/vector.wasm", r //let movm_dynamic_rs = wasm_profiling("rust/.dfx/local/canisters/movm_dynamic/movm_dynamic.wasm"); let file = "README.md"; -output(file, "\n## Map\n\n| |binary_size|generate 1m|max mem|batch_get 50|batch_put 50|batch_remove 50|upgrade|\n|--:|--:|--:|--:|--:|--:|--:|--:|\n"); +output(file, "\n## Map\n\n| |binary_size|generate 800k|max mem|batch_get 50|batch_put 50|batch_remove 50|upgrade|\n|--:|--:|--:|--:|--:|--:|--:|--:|\n"); function perf(wasm, title, init, batch) { let cid = install(wasm, encode (), null); @@ -59,7 +59,7 @@ function perf(wasm, title, init, batch) { uninstall(cid); }; -let init_size = 1_000_000; +let init_size = 800_000; let batch_size = 50; perf(hashmap, "hashmap", init_size, batch_size); @@ -73,7 +73,7 @@ perf(btreemap_stable_rs, "btreemap_stable_rs", init_size, batch_size); perf(imrc_hashmap_rs, "imrc_hashmap_rs", init_size, batch_size); perf(hashmap_rs, "hashmap_rs", init_size, batch_size); -output(file, "\n## Priority queue\n\n| |binary_size|heapify 1m|max mem|pop_min 50|put 50|pop_min 50|upgrade|\n|--:|--:|--:|--:|--:|--:|--:|--:|\n"); +output(file, "\n## Priority queue\n\n| |binary_size|heapify 800k|max mem|pop_min 50|put 50|pop_min 50|upgrade|\n|--:|--:|--:|--:|--:|--:|--:|--:|\n"); perf(heap, "heap", init_size, batch_size); perf(heap_rs, "heap_rs", init_size, batch_size); diff --git a/collections/rust/src/btreemap_stable/src/lib.rs b/collections/rust/src/btreemap_stable/src/lib.rs index 6d8843a1..15d4d268 100644 --- a/collections/rust/src/btreemap_stable/src/lib.rs +++ b/collections/rust/src/btreemap_stable/src/lib.rs @@ -26,7 +26,9 @@ fn generate(size: u32) { #[ic_cdk::query] fn get_mem() -> (u128, u128, u128) { - utils::get_mem() + let memory = ic_cdk::api::stable::CanisterStableMemory::Default(); + let size = memory.stable_size() as u128; + (size, size, size) } #[ic_cdk::update]