Open crusso opened 6 months ago
Note The flamegraph link only works after you merge. Unchanged benchmarks are omitted.
Measure different cryptographic libraries written in both Motoko and Rust.
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.generate 10k
. Insert 10k 7-character word as both key and value into the certified map.max mem
. For Motoko, it reports rts_max_heap_size
after generate
call; 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.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 |
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
SHA-2
Certified map
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%]