mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 07:37:20 +00:00
crypto/kzg4844: preallocate proof slice in ComputeCellProofs (#33703)
Preallocate the proof slice with the known size instead of growing it via append in a loop. The length is already known from the source slice.
This commit is contained in:
parent
424bc22ab8
commit
2513feddf8
2 changed files with 6 additions and 6 deletions
|
|
@ -143,9 +143,9 @@ func ckzgComputeCellProofs(blob *Blob) ([]Proof, error) {
|
|||
if err != nil {
|
||||
return []Proof{}, err
|
||||
}
|
||||
var p []Proof
|
||||
for _, proof := range proofs {
|
||||
p = append(p, (Proof)(proof))
|
||||
p := make([]Proof, len(proofs))
|
||||
for i, proof := range proofs {
|
||||
p[i] = (Proof)(proof)
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,9 +108,9 @@ func gokzgComputeCellProofs(blob *Blob) ([]Proof, error) {
|
|||
if err != nil {
|
||||
return []Proof{}, err
|
||||
}
|
||||
var p []Proof
|
||||
for _, proof := range proofs {
|
||||
p = append(p, (Proof)(proof))
|
||||
p := make([]Proof, len(proofs))
|
||||
for i, proof := range proofs {
|
||||
p[i] = (Proof)(proof)
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue