Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugging: compile sha2 with sanity checks and rtti #112

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

crusso
Copy link

@crusso crusso commented Mar 7, 2024

No description provided.

@crusso crusso marked this pull request as draft March 7, 2024 11:16
@crusso crusso changed the title Claudio/bump cdk sanity check sha2 debugging: compile sha2 with sanity checks and rtti Mar 7, 2024
@crusso crusso changed the base branch from main to moc-tagging-gated March 7, 2024 17:34
.github/workflows/perf.yml Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Mar 7, 2024

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%]

Copy link

github-actions bot commented Mar 7, 2024

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 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.

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

@crusso crusso changed the base branch from moc-tagging-gated to bump-cdk March 7, 2024 23:59
@crusso crusso changed the base branch from bump-cdk to main March 8, 2024 10:30
crypto/motoko/dfx.json Outdated Show resolved Hide resolved
@crusso crusso changed the base branch from main to bump-cdk March 8, 2024 11:04
.github/workflows/perf.yml Outdated Show resolved Hide resolved
@crusso crusso changed the base branch from bump-cdk to main March 10, 2024 20:33
crypto/perf.sh Outdated Show resolved Hide resolved
crypto/perf.sh Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants