Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/m-kus/sp1-bn254-benchmark
Benchmarks for substrate-bn primitives inside a SP1 circuit
https://github.com/m-kus/sp1-bn254-benchmark
bn254 sp1
Last synced: 27 days ago
JSON representation
Benchmarks for substrate-bn primitives inside a SP1 circuit
- Host: GitHub
- URL: https://github.com/m-kus/sp1-bn254-benchmark
- Owner: m-kus
- License: mit
- Created: 2024-05-17T15:51:43.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-06-10T23:13:35.000Z (5 months ago)
- Last Synced: 2024-06-11T01:55:23.560Z (5 months ago)
- Topics: bn254, sp1
- Language: Rust
- Homepage:
- Size: 352 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SP1 BN254 benchmark
Benchmarking original and [patched](https://github.com/m-kus/substrate-bn-sp1) `bn` crate that uses `sys_bigint` precompile for modular multiplication.
Also running E2E benchmarks for [REVM](https://github.com/bluealloy/revm) `alt-bn128-*` precompiles.
## Run
Make sure you have SP1 toolchain [installed](https://succinctlabs.github.io/sp1/getting-started/install.html).
```
make
```## Results
Based on a single run to get rough estimates (TODO: do random sampling for more precise numbers).
| Operation | substrate-bn | substrate-bn-sp1 (patched) |
| - | - | - |
| G1 decoding (uncompressed) | 10,194 | 2,022 |
| G1 encoding | 119,182 | 101,621 |
| G1 addition | 30,034 | 5,301 |
| G1 multiplication | 1,735,257 | 402,823 |
| G2 decoding (uncompressed) | 27,958,488 | 7,798,137 |
| G2 encoding | 162,243 | 117,460 |
| G2 addition | 104,122 | 31,819 |
| G2 multiplication | 31,221,329 | 8,644,149 |
| Miller loop | 33,175,157 | 9,449,627 |
| Final exponentiation | 45,323,747 | 14,574,801 |
| `revm_precompile::bn128::run_add` | 168,171 | 113,580 |
| `revm_precompile::bn128::run_mul` | 1,865,971 | 506,454 |
| `revm_precompile::bn128::run_pair` | 213,099,695 | 63,800,732 |