doc: add desktop nullifier/SMT benchmarks comparison

This commit is contained in:
zero
2024-03-28 12:05:56 +01:00
parent edf36acc88
commit 5bfd718575
6 changed files with 5338 additions and 70 deletions

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 80 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 44 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 66 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

View File

@@ -1,83 +1,36 @@
# ZK Circuits
Tested with `proof/arithmetic.zk`. Graph of verification times:
Use `make bench`. For more info, see the [Criterion docs](https://bheisler.github.io/criterion.rs/book/user_guide/command_line_options.html).
![ZK verification benchmarks](../assets/zk-verif-bench.png)
## Verify `DAO::vote()` Input Proof
Proving times graph looks the same.
### Desktop
```
cargo test bench_zk --release --all-features -- --nocapture
```
Comparison nullifier (red) and SMT (blue)
You may need to compile `proof/arithmetic.zk`. Run `make zkas`, then do
`zkas proof/arithmetic.zk`.
<img src="../assets/bench_verify_dao-vote-input_pdf.svg" width="500">
<img src="../assets/bench_verify_dao-vote-input_iter.svg" width="500">
## Desktop
| Test | # |
|------------|-----------|
| Nullifier | 9.3899 ms |
| SMT | 14.551 ms |
| Change (%) | +54.969% |
```
Benchmarking k=11
Avg proving time: 375 ms
Avg verification time: 3 ms
Benchmarking k=12
Avg proving time: 588 ms
Avg verification time: 5 ms
Benchmarking k=13
Avg proving time: 965 ms
Avg verification time: 8 ms
Benchmarking k=14
Avg proving time: 1688 ms
Avg verification time: 13 ms
Benchmarking k=15
test bench_zk has been running for over 60 seconds
Avg proving time: 3038 ms
Avg verification time: 20 ms
Benchmarking k=16
Avg proving time: 6043 ms
Avg verification time: 35 ms
Benchmarking k=17
Avg proving time: 13297 ms
Avg verification time: 65 ms
Benchmarking k=18
Avg proving time: 26366 ms
Avg verification time: 122 ms
Benchmarking k=19
Avg proving time: 65233 ms
Avg verification time: 219 ms
```
## Verify `DAO::propose()` Input Proof
## Laptop
### Desktop
```
Benchmarking k=11
Avg proving time: 862 ms
Avg verification time: 14 ms
Benchmarking k=12
Avg proving time: 1561 ms
Avg verification time: 21 ms
Benchmarking k=13
test bench_zk has been running for over 60 seconds
Avg proving time: 2908 ms
Avg verification time: 36 ms
Benchmarking k=14
Avg proving time: 5586 ms
Avg verification time: 64 ms
Benchmarking k=15
Avg proving time: 10855 ms
Avg verification time: 114 ms
Benchmarking k=16
Avg proving time: 22996 ms
Avg verification time: 205 ms
Benchmarking k=17
Avg proving time: 52829 ms
Avg verification time: 369 ms
Benchmarking k=18
Avg proving time: 116140 ms
Avg verification time: 708 ms
Benchmarking k=19
Avg proving time: 245032 ms
Avg verification time: 1310 ms
```
Comparison nullifier (red) and SMT (blue)
<img src="../assets/bench_verify_dao-propose-input_pdf.svg" width="500">
<img src="../assets/bench_verify_dao-propose-input_iter.svg" width="500">
| Test | # |
|------------|-----------|
| Nullifier | 9.0842 ms |
| SMT | 14.274 ms |
| Change (%) | +57.126% |
# WASM