Skip to content

Commit f1dff5f

Browse files
authored
Merge pull request #3581 from ethereum/reduce-len-call
Optimization: reduce `len()` calls in `add_polynomialcoeff`
2 parents 3727a75 + 96e41bc commit f1dff5f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

specs/_features/eip7594/polynomial-commitments-sampling.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ def add_polynomialcoeff(a: PolynomialCoeff, b: PolynomialCoeff) -> PolynomialCoe
156156
Sum the coefficient form polynomials ``a`` and ``b``.
157157
"""
158158
a, b = (a, b) if len(a) >= len(b) else (b, a)
159-
return [(a[i] + (b[i] if i < len(b) else 0)) % BLS_MODULUS for i in range(len(a))]
159+
length_a = len(a)
160+
length_b = len(b)
161+
return [(a[i] + (b[i] if i < length_b else 0)) % BLS_MODULUS for i in range(length_a)]
160162
```
161163

162164
#### `neg_polynomialcoeff`

0 commit comments

Comments
 (0)