Skip to main content

Benchmark

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

Building#

# Clone the branch `curve-benchmark` of our forkgit clone https://github.com/patractlabs/jupiter.git \    --branch features/runtime-interfaces \    --depth =1
# Build the templatecargo 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#

memoryprocessor
64GiB System memoryAMD Ryzen 9 5900X 12-Core Processor

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

CurveNativeTime(us)WASMTime(us)Speed(Native/WASM)
bls12_377(~9.5x)native_bls12_377_add9.588wasm_bls12_377_add29.02~3x
native_bls12_377_mul183.1wasm_bls12_377_mul1893~10x
native_bls12_377_pairing_two1732wasm_bls12_377_pairing_two15310~7x
native_bls12_377_mimc_verify7484wasm_bls12_377_mimc_verify64680~9x
bls12_381(~10x)native_bls12_381_add13.9wasm_bls12_381_add28.31~2x
native_bls12_381_mul177.1wasm_bls12_381_mul1879~10x
native_bls12_381_pairing_two1438wasm_bls12_381_pairing_two14770~10x
native_bls12_381_mimc_verify6411wasm_bls12_381_mimc_verify63260~10x
bn254(~5x)native_bn254_add5.631wasm_bn254_add16.05~3x
native_bn254_mul107.7wasm_bn254_mul534.3~5x
native_bn254_pairing_two1150wasm_bn254_pairing_two5061~5x
native_bn254_mimc_verify4178wasm_bn254_mimc_verify19850~5x
bw6_761(~13x)native_bw6_761_add30.35wasm_bw6_761_add26.79\
native_bw6_761_mul963.8wasm_bw6_761_mul14630~15x
native_bw6_761_pairing_two5715wasm_bw6_761_pairing_two60960~10x
native_bw6_761_mimc_verify20330wasm_bw6_761_mimc_verify299800~15x
# 1. Under the jupiter repo# 2. Has compiled jupiter-devsh ./benchmark.sh