Skip to content

xJonathanLEI/pedersen-bench

Repository files navigation

Pedersen Hash Benchmark

Comparison of performance of various Pedersen hash implementations.

Results

Results are divided into two categories: native and Node.js/WebAssembly. Node.js/WebAssembly benchmark results are only presented for Node.js as it has reasonably good WebAssembly performance with the V8 engine.

Native results

pathfinder 👑 starknet-rs starknet-signatures
pedersen_hash 27.858 µs 31.990 µs 143.21 µs
Relative 1.00x 1.15x 5.14x

Node.js/WebAssembly results

starknet-rs 👑 micro-starknet
pedersen_hash 228.67 µs 1.573 ms
Relative 1.00x 6.88x

Implementations

Here's the list of implementations tested along with their platform availability.

Implementation Native Node.js/WebAssembly
geometryresearch/starknet-signatures
eqlabs/pathfinder
xJonathanLEI/starknet-rs
paulmillr/micro-starknet

Environment

  • CPU

    AMD Ryzen 9 5950X 16-Core Processor

  • OS

    Ubuntu 20.04.5 LTS

  • Runtimes

    • wasmer-js: wasmer-js 0.4.1
    • Node.js: v18.12.1

Running benchmarks

Native benchmarks

To run the native benchmarks:

$ cargo bench

WebAssembly benchmarks

To run the WebAssembly benchmarks, make sure you have wasm32-wasi target and cargo-wasi installed. Then build the wasm file:

$ ./scripts/build_bench_wasm.sh

Then you can run the benchmark with your target runtime. For example, to run the benchmark against wasmer-js (Node.js):

$ ./scripts/run_bench_wasm.sh wasmer-js

For more information regarding wasm benchmarks with criterion.rs, check out this guide.

Node.js benchmarks

To run non-wasm Node.js benchmarks, first build the benchmark script:

$ yarn install
$ yarn build

Then run the script with node:

$ node build/js-bench.js

Releases

No releases published

Packages

No packages published