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

bench: add serial MSM benchmark #183

Merged
merged 3 commits into from
Feb 12, 2025
Merged

Conversation

mratsim
Copy link
Contributor

@mratsim mratsim commented Nov 27, 2024

This adds a benchmark for multi-scalar-multiplication on G1. It is the key operation for KZG commitments.

When comparing improvement over blst, using Nim is more convenient than Rust as the Rust wrapper always parallelize MSM.

The code is built in CI to make sure it doesn't go stale.

On a Ryzen 9 9950X, overclocked at 5.9GHz single core turbo.
nim c -r --cc:clang -d:danger --passC:-march=native --hints:off --warnings:off --outdir:build benchmarks/bls12381_msm_g1.nim
image

Constantine
CC=clang nimble bench_ec_msm_bls12_381_g1
image
image
image

Copy link
Contributor

@etan-status etan-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the added benchmark!

Yeah, the double indirection in the API got me as well, one can pass multiple lists without copying all the elements into a merged single list. Also what I ended up using in #178 blst_min_pubkey_sig_core.nim.

    let  # NULL-terminated lists of pointers to lists of values
      publicKeysRef = [toCC(publicKeys[0], cblst_p1_affine), nil]
      signaturesRef = [toCC(signatures[0], cblst_p2_affine), nil]
      scalarsRef = [toCC(blindingScalars[0], byte), nil]

@etan-status etan-status enabled auto-merge (squash) February 12, 2025 16:04
@etan-status etan-status merged commit 52ae433 into status-im:master Feb 12, 2025
24 checks passed
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.

2 participants