xJonathanLEI / felt-bench

Performance comparison of various Starknet field element type implementations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starknet Field Element Benchmark

Comparison of performance of various Starknet field element type implementations.

Results

stark_curve starknet-ff lambdaworks-math cairo-felt
add 3.4542 ns 3.3229 ns 👑 3.6381 ns 18.843 ns
add_assign 1.6485 ns 1.4402 ns 👑 2.4716 ns 24.376 ns
sub 3.4924 ns 3.4418 ns 2.7616 ns 👑 20.667 ns
sub_assign 1.6626 ns 👑 2.4374 ns - 22.982 ns
mul 13.685 ns 16.719 ns 11.972 ns 👑 179.34 ns
mul_assign 12.328 ns 👑 19.707 ns - 189.37 ns
invert 4.2253 µs 1.7744 µs 👑 1.8171 µs -
sqrt 1.8123 ms 133.30 µs 👑 135.79 µs 5.7315 ms
pow 1.0756 µs - 753.13 ns 👑 7.6336 µs

Environment

  • CPU

    AMD Ryzen 9 5950X 16-Core Processor

  • OS

    Ubuntu 22.04.1 LTS

Running benchmarks

To run the benchmarks:

$ cargo bench

Alternatively, pipe all the console output into a file:

$ cargo bench > ./result.log 2>&1

and then generate the Markdown table above with:

$ cargo run

About

Performance comparison of various Starknet field element type implementations


Languages

Language:Rust 100.0%