Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize PeerDAS #292

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

ArtiomTr
Copy link
Contributor

@ArtiomTr ArtiomTr commented Feb 5, 2025

In this PR, several optimizations are ported from rust-eth-kzg:

  1. Batch multiplication precomputation - doing precomputations after loading trusted setup
  2. Using HashMap for deduplicate_commitments
  3. Using HashSet to find missing cell indices in cell recovery
  4. Batch inverse

Parallel benchmark times, with avg. CPU load:

rust-kzg avg load
compute_cells_and_kzg_proofs 48.513 ms 27%-30%
recover_cells_and_kzg_proofs (50% missing) 59.624 ms 25-30%
recover_cells_and_kzg_proofs (25% missing) 61.589 ms 25-30%
recover_cells_and_kzg_proofs (12.5% missing) 57.518 ms 25-30%
recover_cells_and_kzg_proofs (1 missing) 55.628 ms 25-30%
recover_cells_and_kzg_proofs (2 missing) 56.000 ms 25-30%
recover_cells_and_kzg_proofs (3 missing) 55.269 ms 25-30%
recover_cells_and_kzg_proofs (4 missing) 54.523 ms 25-30%
recover_cells_and_kzg_proofs (5 missing) 57.823 ms 25-30%
verify_cell_kzg_proof_batch 148.35 ms 37-40%
verify_cell_kzg_proof_batch (rows)/1 9.1205 ms 18-20%
verify_cell_kzg_proof_batch (rows)/2 12.693 ms 20-22%
verify_cell_kzg_proof_batch (rows)/4 16.208 ms 23-24%
verify_cell_kzg_proof_batch (rows)/8 24.932 ms 27-30%
verify_cell_kzg_proof_batch (rows)/16 41.965 ms 30-33%
verify_cell_kzg_proof_batch (rows)/32 76.117 ms 30-33%
verify_cell_kzg_proof_batch (rows)/64 147.48 ms 34%
verify_cell_kzg_proof_batch (columns)/1 9.0926 ms 20-22%
verify_cell_kzg_proof_batch (columns)/2 9.8894 ms 22-24%
verify_cell_kzg_proof_batch (columns)/4 12.491 ms 26-27%
verify_cell_kzg_proof_batch (columns)/8 16.998 ms 27-28%
verify_cell_kzg_proof_batch (columns)/16 27.090 ms 28-30%
verify_cell_kzg_proof_batch (columns)/32 42.328 ms 29-30%
verify_cell_kzg_proof_batch (columns)/64 75.353 ms 32-34%
verify_cell_kzg_proof_batch (columns)/128 153.58 ms 38-40%

@ArtiomTr ArtiomTr force-pushed the optimize-peer-das branch 4 times, most recently from c38362f to ac09681 Compare February 11, 2025 18:58
@sauliusgrigaitis
Copy link
Member

Is this still in draft mode?

@ArtiomTr
Copy link
Contributor Author

Yeah, I've replaced std HashMap & HashSet with hashbrown because of no_std support, so I want to re-run benchmarks to make sure that performance haven't degraded

@ArtiomTr ArtiomTr marked this pull request as ready for review February 12, 2025 16:46
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