From 8f6270d790358fc3ec223cb29a5f032cca32cf17 Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Mon, 3 Mar 2025 21:46:10 +0100 Subject: [PATCH 1/9] Upgrade Rust toolchain to 1.81 --- .github/workflows/ci.yml | 2 +- Cargo.lock | 6 +++--- rust-toolchain.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1274bdb..568b452f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: [pull_request] env: - RUST_VERSION: 1.75.0 + RUST_VERSION: 1.81.0 jobs: build: diff --git a/Cargo.lock b/Cargo.lock index 5a83ec33..10303eb7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -200,7 +200,7 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "canbench" -version = "0.1.8" +version = "0.1.9" dependencies = [ "canbench-rs", "candid", @@ -221,7 +221,7 @@ dependencies = [ [[package]] name = "canbench-rs" -version = "0.1.8" +version = "0.1.9" dependencies = [ "canbench-rs-macros", "candid", @@ -232,7 +232,7 @@ dependencies = [ [[package]] name = "canbench-rs-macros" -version = "0.1.8" +version = "0.1.9" dependencies = [ "proc-macro2", "quote", diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b30063f1..5c6d171a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.75.0" # NOTE: remember to update CI as well. +channel = "1.81.0" # NOTE: remember to update CI as well. targets = ["wasm32-unknown-unknown"] From 39b11d02e94a3b36ef1c209de43303318a725753 Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Mon, 3 Mar 2025 21:58:09 +0100 Subject: [PATCH 2/9] Upgrade GitHub workflow --- .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 568b452f..04b510d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v2 - name: Cache Cargo - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.cargo/registry From f130924399ba1ba2c18d1f7884b04ca2220405c6 Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Mon, 3 Mar 2025 22:02:31 +0100 Subject: [PATCH 3/9] Fix clippy --- canbench-rs/src/lib.rs | 3 ++- tests/init_arg/src/main.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/canbench-rs/src/lib.rs b/canbench-rs/src/lib.rs index 100189a9..353a7e15 100644 --- a/canbench-rs/src/lib.rs +++ b/canbench-rs/src/lib.rs @@ -409,7 +409,8 @@ use std::cell::RefCell; use std::collections::BTreeMap; thread_local! { - static SCOPES: RefCell> = RefCell::new(BTreeMap::new()); + static SCOPES: RefCell> = + const { RefCell::new(BTreeMap::new()) }; } /// The results of a benchmark. diff --git a/tests/init_arg/src/main.rs b/tests/init_arg/src/main.rs index 4fba7bdb..5f66fde2 100644 --- a/tests/init_arg/src/main.rs +++ b/tests/init_arg/src/main.rs @@ -2,7 +2,7 @@ use canbench_rs::bench; use std::cell::RefCell; thread_local! { - static STATE: RefCell = RefCell::new(String::new()); + static STATE: RefCell = const { RefCell::new(String::new()) }; } // A benchmark that prints the state. #[bench] From cfad12eb13818442851dba811141ba769e9ddfef Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Tue, 4 Mar 2025 07:35:50 +0100 Subject: [PATCH 4/9] Fix tests --- canbench-bin/tests/tests.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/canbench-bin/tests/tests.rs b/canbench-bin/tests/tests.rs index d323c5c8..3b17ade5 100644 --- a/canbench-bin/tests/tests.rs +++ b/canbench-bin/tests/tests.rs @@ -279,17 +279,17 @@ fn reports_scopes_in_new_benchmark() { Benchmark: bench_scope_new (new) total: - instructions: 3411 (new) + instructions: 3579 (new) heap_increase: 0 pages (new) stable_memory_increase: 0 pages (new) scope_1 (scope): - instructions: 1002 (new) + instructions: 1286 (new) heap_increase: 0 pages (new) stable_memory_increase: 0 pages (new) scope_2 (scope): - instructions: 787 (new) + instructions: 740 (new) heap_increase: 0 pages (new) stable_memory_increase: 0 pages (new) @@ -356,17 +356,17 @@ fn reports_scopes_in_existing_benchmark() { Benchmark: bench_scope_exists total: - instructions: 3411 (regressed from 0) + instructions: 3579 (regressed from 0) heap_increase: 0 pages (no change) stable_memory_increase: 0 pages (no change) scope_1 (scope): - instructions: 1002 (regressed by 25.25%) + instructions: 1286 (regressed by 60.75%) heap_increase: 0 pages (improved by 100.00%) stable_memory_increase: 0 pages (no change) scope_2 (scope): - instructions: 787 (new) + instructions: 740 (new) heap_increase: 0 pages (new) stable_memory_increase: 0 pages (new) @@ -400,7 +400,7 @@ fn benchmark_works_with_init_args() { Benchmark: state_check total: - instructions: 804 (no change) + instructions: 867 (regressed by 7.84%) heap_increase: 0 pages (no change) stable_memory_increase: 0 pages (no change) @@ -423,7 +423,7 @@ fn benchmark_stable_writes() { Benchmark: write_stable_memory (new) total: - instructions: 49.09 K (new) + instructions: 49.12 K (new) heap_increase: 0 pages (new) stable_memory_increase: 1 pages (new) From 5729d6ba955a7de91b8941ff30bb7fd722e31bb4 Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Tue, 4 Mar 2025 08:07:53 +0100 Subject: [PATCH 5/9] Fix CI --- canbench-bin/tests/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canbench-bin/tests/tests.rs b/canbench-bin/tests/tests.rs index 3b17ade5..eb4b2039 100644 --- a/canbench-bin/tests/tests.rs +++ b/canbench-bin/tests/tests.rs @@ -400,7 +400,7 @@ fn benchmark_works_with_init_args() { Benchmark: state_check total: - instructions: 867 (regressed by 7.84%) + instructions: 930 (regressed by 15.67%) heap_increase: 0 pages (no change) stable_memory_increase: 0 pages (no change) From 439acbfbdb6b22a12d5a469693f2a7ff2a637090 Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Tue, 4 Mar 2025 09:07:15 +0100 Subject: [PATCH 6/9] Update canbench results --- examples/btreemap_vs_hashmap/canbench_results.yml | 12 ++++++------ examples/fibonacci/canbench_results.yml | 6 +++--- tests/init_arg/canbench_results.yml | 11 +++++------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/examples/btreemap_vs_hashmap/canbench_results.yml b/examples/btreemap_vs_hashmap/canbench_results.yml index a2172557..a3909d85 100644 --- a/examples/btreemap_vs_hashmap/canbench_results.yml +++ b/examples/btreemap_vs_hashmap/canbench_results.yml @@ -1,28 +1,28 @@ benches: insert_users: total: - instructions: 2570835903 + instructions: 2555314794 heap_increase: 871 stable_memory_increase: 0 scopes: {} pre_upgrade_bench: total: - instructions: 743977526 + instructions: 787867913 heap_increase: 519 stable_memory_increase: 184 scopes: serialize_state: - instructions: 729045047 + instructions: 772935595 heap_increase: 519 stable_memory_increase: 0 writing_to_stable_memory: - instructions: 14930540 + instructions: 14930478 heap_increase: 0 stable_memory_increase: 184 remove_users: total: - instructions: 2072135114 + instructions: 2095990298 heap_increase: 0 stable_memory_increase: 0 scopes: {} -version: 0.1.5 +version: 0.1.9 diff --git a/examples/fibonacci/canbench_results.yml b/examples/fibonacci/canbench_results.yml index 04add25e..867bf3ac 100644 --- a/examples/fibonacci/canbench_results.yml +++ b/examples/fibonacci/canbench_results.yml @@ -1,14 +1,14 @@ benches: fibonacci_20: total: - instructions: 2224 + instructions: 2538 heap_increase: 0 stable_memory_increase: 0 scopes: {} fibonacci_45: total: - instructions: 3011 + instructions: 3331 heap_increase: 0 stable_memory_increase: 0 scopes: {} -version: 0.1.1 +version: 0.1.9 diff --git a/tests/init_arg/canbench_results.yml b/tests/init_arg/canbench_results.yml index 49a50a7e..7128e1e1 100644 --- a/tests/init_arg/canbench_results.yml +++ b/tests/init_arg/canbench_results.yml @@ -1,9 +1,8 @@ -# The results in this file are artificial and are designed to trigger -# certain scenarios. benches: state_check: total: - heap_delta: 0 - instructions: 804 - stable_memory_delta: 0 -version: 0.1.0 + instructions: 867 + heap_increase: 0 + stable_memory_increase: 0 + scopes: {} +version: 0.1.9 From e6a50ebdf4d0cb5d29147a554c4ee2824139f462 Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Tue, 4 Mar 2025 09:27:06 +0100 Subject: [PATCH 7/9] Fix the test --- canbench-bin/tests/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canbench-bin/tests/tests.rs b/canbench-bin/tests/tests.rs index eb4b2039..92b15806 100644 --- a/canbench-bin/tests/tests.rs +++ b/canbench-bin/tests/tests.rs @@ -400,7 +400,7 @@ fn benchmark_works_with_init_args() { Benchmark: state_check total: - instructions: 930 (regressed by 15.67%) + instructions: 930 (regressed by 7.27%) heap_increase: 0 pages (no change) stable_memory_increase: 0 pages (no change) From 3336475e16b5a87f8cf45ed796857d5edd8e2a6b Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Tue, 4 Mar 2025 10:38:05 +0100 Subject: [PATCH 8/9] Upgrade to 1.84 --- .github/workflows/ci.yml | 2 +- rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04b510d5..4f5bcbb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: [pull_request] env: - RUST_VERSION: 1.81.0 + RUST_VERSION: 1.84.0 jobs: build: diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5c6d171a..bef0374c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.81.0" # NOTE: remember to update CI as well. +channel = "1.84.0" # NOTE: remember to update CI as well. targets = ["wasm32-unknown-unknown"] From d738cfa5087fa5f8fcadc8a47ccd9c68b95ee63d Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Tue, 4 Mar 2025 13:19:07 +0100 Subject: [PATCH 9/9] Update tests and results --- canbench-bin/tests/tests.rs | 14 +++++++------- examples/btreemap_vs_hashmap/canbench_results.yml | 10 +++++----- examples/fibonacci/canbench_results.yml | 4 ++-- tests/init_arg/canbench_results.yml | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/canbench-bin/tests/tests.rs b/canbench-bin/tests/tests.rs index 92b15806..771de7b7 100644 --- a/canbench-bin/tests/tests.rs +++ b/canbench-bin/tests/tests.rs @@ -279,17 +279,17 @@ fn reports_scopes_in_new_benchmark() { Benchmark: bench_scope_new (new) total: - instructions: 3579 (new) + instructions: 3165 (new) heap_increase: 0 pages (new) stable_memory_increase: 0 pages (new) scope_1 (scope): - instructions: 1286 (new) + instructions: 913 (new) heap_increase: 0 pages (new) stable_memory_increase: 0 pages (new) scope_2 (scope): - instructions: 740 (new) + instructions: 714 (new) heap_increase: 0 pages (new) stable_memory_increase: 0 pages (new) @@ -356,17 +356,17 @@ fn reports_scopes_in_existing_benchmark() { Benchmark: bench_scope_exists total: - instructions: 3579 (regressed from 0) + instructions: 3165 (regressed from 0) heap_increase: 0 pages (no change) stable_memory_increase: 0 pages (no change) scope_1 (scope): - instructions: 1286 (regressed by 60.75%) + instructions: 913 (regressed by 14.12%) heap_increase: 0 pages (improved by 100.00%) stable_memory_increase: 0 pages (no change) scope_2 (scope): - instructions: 740 (new) + instructions: 714 (new) heap_increase: 0 pages (new) stable_memory_increase: 0 pages (new) @@ -400,7 +400,7 @@ fn benchmark_works_with_init_args() { Benchmark: state_check total: - instructions: 930 (regressed by 7.27%) + instructions: 872 (no change) heap_increase: 0 pages (no change) stable_memory_increase: 0 pages (no change) diff --git a/examples/btreemap_vs_hashmap/canbench_results.yml b/examples/btreemap_vs_hashmap/canbench_results.yml index a3909d85..06646dd5 100644 --- a/examples/btreemap_vs_hashmap/canbench_results.yml +++ b/examples/btreemap_vs_hashmap/canbench_results.yml @@ -1,27 +1,27 @@ benches: insert_users: total: - instructions: 2555314794 + instructions: 2554172078 heap_increase: 871 stable_memory_increase: 0 scopes: {} pre_upgrade_bench: total: - instructions: 787867913 + instructions: 807868600 heap_increase: 519 stable_memory_increase: 184 scopes: serialize_state: - instructions: 772935595 + instructions: 792936247 heap_increase: 519 stable_memory_increase: 0 writing_to_stable_memory: - instructions: 14930478 + instructions: 14930479 heap_increase: 0 stable_memory_increase: 184 remove_users: total: - instructions: 2095990298 + instructions: 2109060905 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/examples/fibonacci/canbench_results.yml b/examples/fibonacci/canbench_results.yml index 867bf3ac..ec334195 100644 --- a/examples/fibonacci/canbench_results.yml +++ b/examples/fibonacci/canbench_results.yml @@ -1,13 +1,13 @@ benches: fibonacci_20: total: - instructions: 2538 + instructions: 2187 heap_increase: 0 stable_memory_increase: 0 scopes: {} fibonacci_45: total: - instructions: 3331 + instructions: 2925 heap_increase: 0 stable_memory_increase: 0 scopes: {} diff --git a/tests/init_arg/canbench_results.yml b/tests/init_arg/canbench_results.yml index 7128e1e1..54787d21 100644 --- a/tests/init_arg/canbench_results.yml +++ b/tests/init_arg/canbench_results.yml @@ -1,7 +1,7 @@ benches: state_check: total: - instructions: 867 + instructions: 872 heap_increase: 0 stable_memory_increase: 0 scopes: {}