canister-profiling icon indicating copy to clipboard operation
canister-profiling copied to clipboard

experiment: trivial change to trigger CI

Open crusso opened this issue 9 months ago • 2 comments

crusso avatar Mar 19 '25 14:03 crusso

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

Basic DAO

binary_size init transfer_token submit_proposal vote_proposal upgrade
Motoko 278_879 513_370 ($\textcolor{red}{0.01\%}$) 23_340 ($\textcolor{red}{0.25\%}$) 19_183 ($\textcolor{green}{-0.32\%}$) 20_394 ($\textcolor{green}{-0.33\%}$) 162_143 ($\textcolor{red}{0.01\%}$)
Rust 902_362 516_184 92_673 118_753 113_669 1_499_571

DIP721 NFT

binary_size init mint_token transfer_token upgrade
Motoko 225_006 482_239 31_104 8_880 92_429
Rust 931_779 205_310 309_520 73_609 1_635_207 ($\textcolor{red}{0.00\%}$)

Statistics

  • binary_size: no change
  • max_mem: no change
  • cycles: -0.06% [-0.25%, 0.12%]

Overall Statistics

  • binary_size: no change
  • max_mem: no change
  • cycles: -0.06% [-0.25%, 0.12%]

github-actions[bot] avatar Mar 19 '25 15:03 github-actions[bot]

Note The flamegraph link only works after you merge. Unchanged benchmarks are omitted.

Sample Dapps

Measure the performance of some typical dapps:

  • Basic DAO, with heartbeat disabled to make profiling easier. We have a separate benchmark to measure heartbeat performance.
  • DIP721 NFT

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 upgrade
Motoko 278_879 513_370 23_340 19_183 20_394 162_143
Rust 902_362 516_184 92_673 118_753 113_669 1_499_571

DIP721 NFT

binary_size init mint_token transfer_token upgrade
Motoko 225_006 482_239 31_104 8_880 92_429
Rust 931_779 205_310 309_520 73_609 1_635_207

Environment

  • dfx 0.24.0
  • Motoko compiler 0.13.3 (source ff4il9yc-sfakbpl1-8z4dm2d6-ybdjncj7)
  • rustc 1.81.0 (eeb90cda1 2024-09-04)
  • ic-repl 0.7.6
  • ic-wasm 0.9.0

github-actions[bot] avatar Mar 19 '25 15:03 github-actions[bot]