canister-profiling
canister-profiling copied to clipboard
debugging: compile sha2 with sanity checks and rtti
Note Diffing the performance result against the published result from main branch. Unchanged benchmarks are omitted.
SHA-2
| binary_size | SHA-256 | SHA-512 | account_id | neuron_id | |
|---|---|---|---|---|---|
| Motoko | 193_686 ($\textcolor{green}{-1.43\%}$) | 267_743_355 ($\textcolor{green}{-1.94\%}$) | 247_834_501 ($\textcolor{green}{-4.62\%}$) | 33_636 ($\textcolor{green}{-2.14\%}$) | 24_532 ($\textcolor{green}{-1.47\%}$) |
| Rust | 538_677 ($\textcolor{red}{0.24\%}$) | 82_788_763 ($\textcolor{red}{0.00\%}$) | 56_793_160 ($\textcolor{red}{0.00\%}$) | 47_956 ($\textcolor{red}{0.09\%}$) | 50_870 ($\textcolor{red}{0.96\%}$) |
Certified map
| binary_size | generate 10k | max mem | inc | witness | upgrade | |
|---|---|---|---|---|---|---|
| Motoko | 243_641 ($\textcolor{green}{-0.63\%}$) | 4_666_119_661 ($\textcolor{green}{-2.04\%}$) | 3_430_044 | 553_629 ($\textcolor{green}{-2.03\%}$) | 407_936 ($\textcolor{red}{1.46\%}$) | 274_434_719 ($\textcolor{red}{0.06\%}$) |
| Rust | 579_504 ($\textcolor{red}{2.42\%}$) | 6_409_378_412 ($\textcolor{red}{0.00\%}$) | 2_228_224 | 1_020_591 ($\textcolor{red}{0.06\%}$) | 304_778 ($\textcolor{red}{0.29\%}$) | 6_025_902_205 ($\textcolor{red}{0.11\%}$) |
Statistics
- binary_size: 0.15% [-1.80%, 2.11%]
- max_mem: no change
- cycles: -0.70% [-1.37%, -0.03%]
Overall Statistics
- binary_size: 0.15% [-1.80%, 2.11%]
- max_mem: no change
- cycles: -0.70% [-1.37%, -0.03%]
Note The flamegraph link only works after you merge. Unchanged benchmarks are omitted.
Cryptographic libraries
Measure different cryptographic libraries written in both Motoko and Rust.
- SHA-2 benchmarks
SHA-256/SHA-512. Compute the hash of a 1M Wasm binary.account_id. Compute the ledger account id from principal, based on SHA-224.neuron_id. Compute the NNS neuron id from principal, based on SHA-256.
- Certified map. Merkle Tree for storing key-value pairs and generate witness according to the IC Interface Specification.
generate 10k. Insert 10k 7-character word as both key and value into the certified map.max mem. For Motoko, it reportsrts_max_heap_sizeaftergeneratecall; For Rust, it reports the Wasm's memory page * 32Kb.inc. Increment a counter and insert the counter value into the map.witness. Generate the root hash and a witness for the counter.upgrade. Upgrade the canister with the same Wasm. In Motoko, we use stable variable. In Rust, we convert the tree to a vector before serialization.
SHA-2
| binary_size | SHA-256 | SHA-512 | account_id | neuron_id | |
|---|---|---|---|---|---|
| Motoko | 193_686 | 267_743_355 | 247_834_501 | 33_636 | 24_532 |
| Rust | 538_677 | 82_788_763 | 56_793_160 | 47_956 | 50_870 |
Certified map
| binary_size | generate 10k | max mem | inc | witness | upgrade | |
|---|---|---|---|---|---|---|
| Motoko | 243_641 | 4_666_119_661 | 3_430_044 | 553_629 | 407_936 | 274_434_719 |
| Rust | 579_504 | 6_409_378_412 | 2_228_224 | 1_020_591 | 304_778 | 6_025_902_205 |
Environment
- dfx 0.18.0-beta.3
- Motoko compiler 0.11.0 (source w84wh4l6-chnwnpi7-5vpqb66v-dbanzv76)
- rustc 1.76.0 (07dca489a 2024-02-04)
- ic-repl 0.6.2
- ic-wasm 0.7.0