dfinity / canister-profiling

Collection of canister performance benchmarks
Apache License 2.0
21 stars 8 forks source link

bump certified map dependency #73

Closed chenyan-dfinity closed 11 months ago

github-actions[bot] commented 1 year ago

Note Diffing the performance result against the published result from main branch. Unchanged benchmarks are omitted.

SHA-2

Note Same as main branch, skipping.

Certified map

binary_size generate 10k max mem inc witness
Motoko 178_273 ($\textcolor{red}{6.83\%}$) 5_013_614_870 ($\textcolor{green}{-73.02\%}$) 3_429_924 594_192 ($\textcolor{green}{-73.11\%}$) 327_767
Rust 441_794 6_202_163_062 1_081_344 983_904 288_469

Statistics

Basic DAO

binary_size init transfer_token submit_proposal vote_proposal
Motoko 230_242 37_614 16_290 ($\textcolor{green}{-0.28\%}$) 12_672 ($\textcolor{green}{-0.33\%}$) 14_136 ($\textcolor{green}{-0.19\%}$)
Rust 718_379 472_438 ($\textcolor{red}{0.01\%}$) 86_786 105_263 116_229

DIP721 NFT

Note Same as main branch, skipping.

Statistics

Heartbeat

binary_size heartbeat
Motoko 123_357 7_399 ($\textcolor{red}{96.89\%}$)
Rust 23_625 785

Timer

Note Same as main branch, skipping.

Statistics

github-actions[bot] commented 1 year ago

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

binary_size SHA-256 SHA-512 account_id neuron_id
Motoko 174_597 264_156_360 235_099_580 35_153 23_262
Rust 498_272 82_512_024 56_525_977 42_551 44_574

Certified map

binary_size generate 10k max mem inc witness
Motoko 178_273 5_013_614_870 3_429_924 594_192 327_767
Rust 441_794 6_202_163_062 1_081_344 983_904 288_469

Sample Dapps

Measure the performance of some typical dapps:

Note

  • The cost difference is mainly due to the Candid serialization cost.
  • Motoko statically compiles/specializes the serialization code for each method, whereas in Rust, we use serde to dynamically deserialize data based on data on the wire.
  • We could improve the performance on the Rust side by using parser combinators. But it is a challenge to maintain the ergonomics provided by serde.
  • For real-world applications, we tend to send small data for each endpoint, which makes the Candid overhead in Rust tolerable.

Basic DAO

binary_size init transfer_token submit_proposal vote_proposal
Motoko 230_242 37_614 16_290 12_672 14_136
Rust 718_379 472_438 86_786 105_263 116_229

DIP721 NFT

binary_size init mint_token transfer_token
Motoko 188_321 12_267 22_357 4_729
Rust 778_280 125_293 325_017 77_500

Heartbeat / Timer

Measure the cost of empty heartbeat and timer job.

Heartbeat

binary_size heartbeat
Motoko 123_357 7_399
Rust 23_625 785

Timer

binary_size setTimer cancelTimer
Motoko 129_636 15_227 1_684
Rust 443_367 43_417 7_497