Skip to content

add benchmark for recovering cells without computing proofs#596

Merged
asn-d6 merged 2 commits intoethereum:mainfrom
cskiraly:benchmark-recover-cells-only
Sep 4, 2025
Merged

add benchmark for recovering cells without computing proofs#596
asn-d6 merged 2 commits intoethereum:mainfrom
cskiraly:benchmark-recover-cells-only

Conversation

@cskiraly
Copy link
Contributor

@cskiraly cskiraly commented Sep 2, 2025

We will often need to recover cells only, without recovering the associated proofs, since proofs will already be available from a side-channel (e.g. as part of a message sent before the per-cell diffusion starts).

The API already supports this by setting the proofs array to NULL. This PR adds benchmarks.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
@cskiraly
Copy link
Contributor Author

cskiraly commented Sep 2, 2025

Some reference numbers with the current branch on a Macbook Pro M1

goos: darwin
goarch: arm64
pkg: github.com/ethereum/c-kzg-4844/v2/bindings/go
cpu: Apple M1
Benchmark/ComputeCells               458           2799416 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=0)                       4         280863979 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=1)                       2         962029125 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=2)                       2         519934146 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=3)                       3         507837917 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=4)                       4         293343365 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=5)                       4         255128115 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=6)                       5         226165750 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=7)                       5         207891258 ns/op
Benchmark/ComputeCellsAndKZGProofs(precompute=8)                       6         189214535 ns/op
Benchmark/ComputeCellsAndKZGProofsParallel(count=8)                    4         328514510 ns/op
Benchmark/RecoverCells(missing=50.0%)                 55          22094399 ns/op
Benchmark/RecoverCells(missing=25.0%)                 54          21380794 ns/op
Benchmark/RecoverCells(missing=12.5%)                 55          29083810 ns/op
Benchmark/RecoverCells(missing=1)                     52          21519530 ns/op
Benchmark/RecoverCells(missing=2)                     54          21420107 ns/op
Benchmark/RecoverCellsAndKZGProofs(missing=50.0%)                      5         207627083 ns/op
Benchmark/RecoverCellsAndKZGProofs(missing=25.0%)                      5         208015733 ns/op
Benchmark/RecoverCellsAndKZGProofs(missing=12.5%)                      5         209756142 ns/op
Benchmark/RecoverCellsAndKZGProofs(missing=1)                          5         207826692 ns/op
Benchmark/RecoverCellsAndKZGProofs(missing=2)                          5         209587925 ns/op
Benchmark/RecoverCellsAndKZGProofs(missing=3)                          5         211216258 ns/op
Benchmark/RecoverCellsAndKZGProofs(missing=4)                          5         211892058 ns/op
Benchmark/RecoverCellsAndKZGProofs(missing=5)                          5         208400917 ns/op
PASS

@cskiraly cskiraly changed the title add benchmark for recovering cells without proofs add benchmark for recovering cells without computing proofs Sep 2, 2025
Copy link
Contributor

@asn-d6 asn-d6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @cskiraly!

(Fixed a tiny nit with ea164c6 to unify the funcdoc with the rest of the file's style)

@asn-d6 asn-d6 merged commit 67fa23b into ethereum:main Sep 4, 2025
42 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants