From 41a85690d4e981e73351e84fb27a3013706b15cf Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Thu, 10 Jul 2025 12:36:20 +0200 Subject: [PATCH 1/5] refactor: rename compare benchmarks to io_chunks --- .github/workflows/ci.yml | 6 +++--- benchmarks/Cargo.toml | 4 ++-- benchmarks/{compare => io_chunks}/canbench.yml | 0 benchmarks/{compare => io_chunks}/canbench_results.yml | 0 benchmarks/{compare => io_chunks}/src/main.rs | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename benchmarks/{compare => io_chunks}/canbench.yml (100%) rename benchmarks/{compare => io_chunks}/canbench_results.yml (100%) rename benchmarks/{compare => io_chunks}/src/main.rs (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aeb8dc56..4afd271c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: - btreeset - memory-manager - vec - - compare + - io_chunks include: - name: btreemap project_dir: ./benchmarks/btreemap @@ -106,8 +106,8 @@ jobs: project_dir: ./benchmarks/memory_manager - name: vec project_dir: ./benchmarks/vec - - name: compare - project_dir: ./benchmarks/compare + - name: io_chunks + project_dir: ./benchmarks/io_chunks env: PROJECT_DIR: ${{ matrix.project_dir }} diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 753b1972..cdc9f771 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -31,8 +31,8 @@ name = "vec" path = "vec/src/main.rs" [[bin]] -name = "compare" -path = "compare/src/main.rs" +name = "io_chunks" +path = "io_chunks/src/main.rs" [[bin]] name = "btreeset" diff --git a/benchmarks/compare/canbench.yml b/benchmarks/io_chunks/canbench.yml similarity index 100% rename from benchmarks/compare/canbench.yml rename to benchmarks/io_chunks/canbench.yml diff --git a/benchmarks/compare/canbench_results.yml b/benchmarks/io_chunks/canbench_results.yml similarity index 100% rename from benchmarks/compare/canbench_results.yml rename to benchmarks/io_chunks/canbench_results.yml diff --git a/benchmarks/compare/src/main.rs b/benchmarks/io_chunks/src/main.rs similarity index 100% rename from benchmarks/compare/src/main.rs rename to benchmarks/io_chunks/src/main.rs From ac7c8862a1912fcfc56c2ba86fb1c14be5af95fc Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Thu, 10 Jul 2025 12:41:59 +0200 Subject: [PATCH 2/5] add doc comment --- benchmarks/io_chunks/src/main.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/benchmarks/io_chunks/src/main.rs b/benchmarks/io_chunks/src/main.rs index 04148e0f..cfe6ba73 100644 --- a/benchmarks/io_chunks/src/main.rs +++ b/benchmarks/io_chunks/src/main.rs @@ -1,3 +1,21 @@ +//! # I/O Chunks Benchmark +//! +//! Measures read/write performance across different stable storage approaches +//! when handling 100 MiB of data split into varying chunk sizes. +//! +//! Tests approaches: +//! - **Stable Memory**: Direct memory operations (baseline) +//! - **BTreeMap**: Key-value storage with chunk index as key +//! - **StableVec**: Sequential storage pushing chunks +//! +//! Each approach is tested with: +//! - 1 chunk (100 MiB) +//! - 1K chunks (~100 KiB each) +//! - 1M chunks (~100 B each) +//! +//! **Goal**: Evaluate how chunk size affects performance and compare +//! the overhead of stable structures versus raw memory operations. + use benchmarks::vec::BoundedVecN; use canbench_rs::{bench, bench_fn, BenchResult}; use ic_cdk::api::stable::WASM_PAGE_SIZE_IN_BYTES; From 75a2335493682d15430ee9c51c1bac70b413471d Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Thu, 10 Jul 2025 12:50:27 +0200 Subject: [PATCH 3/5] remove io_chunks from ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4afd271c..5587e929 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: - btreeset - memory-manager - vec - - io_chunks + # - io_chunks TODO: re-enable after new folder is merged. include: - name: btreemap project_dir: ./benchmarks/btreemap From f628f7f1c9788adadaf22958532420c8cb0bbb2d Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Thu, 10 Jul 2025 12:51:09 +0200 Subject: [PATCH 4/5] . --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5587e929..be2c35be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,20 +94,20 @@ jobs: name: - btreemap - btreeset + # - io_chunks TODO: re-enable after new folder is merged. - memory-manager - vec - # - io_chunks TODO: re-enable after new folder is merged. include: - name: btreemap project_dir: ./benchmarks/btreemap - name: btreeset project_dir: ./benchmarks/btreeset + - name: io_chunks + project_dir: ./benchmarks/io_chunks - name: memory-manager project_dir: ./benchmarks/memory_manager - name: vec project_dir: ./benchmarks/vec - - name: io_chunks - project_dir: ./benchmarks/io_chunks env: PROJECT_DIR: ${{ matrix.project_dir }} From ff0274e2460dabe811f38275eac6579961650e2a Mon Sep 17 00:00:00 2001 From: Maksym Arutyunyan Date: Thu, 10 Jul 2025 12:56:04 +0200 Subject: [PATCH 5/5] . --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be2c35be..120febf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,8 +102,8 @@ jobs: project_dir: ./benchmarks/btreemap - name: btreeset project_dir: ./benchmarks/btreeset - - name: io_chunks - project_dir: ./benchmarks/io_chunks + # - name: io_chunks + # project_dir: ./benchmarks/io_chunks - name: memory-manager project_dir: ./benchmarks/memory_manager - name: vec