Benchmark

# Benchmark

We have constructed the tests of zkMega curves (opens new window) in pallet-template (opens new window) which imports the curves from zkMega directly(Wasm) and with runtime-interface (opens new window)(Native).

# Building

# Clone the branch `curve-benchmark` of our fork
git clone https://github.com/patractlabs/jupiter.git \
    --branch features/runtime-interfaces \
    --depth =1

# Build the template
cargo build -p jupiter-dev --all-features --release

# Check the command benchmark works fine
# ./target/release/jupiter-dev benchmark -p pallet_template -e wasm_bls_12_381_add
./target/release/jupiter-dev benchmark -p pallet_template -e wasm_bls_12_381_add

# Result

memory processor
64GiB System memory AMD Ryzen 9 5900X 12-Core Processor

Here we test the curevs on ubuntu LTS 20.04, Time is measured in us

Curve Native Time(us) WASM Time(us) Speed(Native/WASM)
bls12_377(~9.5x) native_bls12_377_add 9.588 wasm_bls12_377_add 29.02 ~3x
native_bls12_377_mul 183.1 wasm_bls12_377_mul 1893 ~10x
native_bls12_377_pairing_two 1732 wasm_bls12_377_pairing_two 15310 ~7x
native_bls12_377_mimc_verify 7484 wasm_bls12_377_mimc_verify 64680 ~9x
bls12_381(~10x) native_bls12_381_add 13.9 wasm_bls12_381_add 28.31 ~2x
native_bls12_381_mul 177.1 wasm_bls12_381_mul 1879 ~10x
native_bls12_381_pairing_two 1438 wasm_bls12_381_pairing_two 14770 ~10x
native_bls12_381_mimc_verify 6411 wasm_bls12_381_mimc_verify 63260 ~10x
bn254(~5x) native_bn254_add 5.631 wasm_bn254_add 16.05 ~3x
native_bn254_mul 107.7 wasm_bn254_mul 534.3 ~5x
native_bn254_pairing_two 1150 wasm_bn254_pairing_two 5061 ~5x
native_bn254_mimc_verify 4178 wasm_bn254_mimc_verify 19850 ~5x
bw6_761(~13x) native_bw6_761_add 30.35 wasm_bw6_761_add 26.79 \
native_bw6_761_mul 963.8 wasm_bw6_761_mul 14630 ~15x
native_bw6_761_pairing_two 5715 wasm_bw6_761_pairing_two 60960 ~10x
native_bw6_761_mimc_verify 20330 wasm_bw6_761_mimc_verify 299800 ~15x
# 1. Under the jupiter repo
# 2. Has compiled jupiter-dev
sh ./benchmark.sh