From 96e41bca3015d4f4c8d8d136c3e217081df161fe Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 16 Jan 2024 16:51:05 +0800 Subject: [PATCH] Optimization: reduce `len()` call --- specs/_features/eip7594/polynomial-commitments-sampling.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specs/_features/eip7594/polynomial-commitments-sampling.md b/specs/_features/eip7594/polynomial-commitments-sampling.md index b356792e3..601144abd 100644 --- a/specs/_features/eip7594/polynomial-commitments-sampling.md +++ b/specs/_features/eip7594/polynomial-commitments-sampling.md @@ -156,7 +156,9 @@ def add_polynomialcoeff(a: PolynomialCoeff, b: PolynomialCoeff) -> PolynomialCoe Sum the coefficient form polynomials ``a`` and ``b``. """ a, b = (a, b) if len(a) >= len(b) else (b, a) - return [(a[i] + (b[i] if i < len(b) else 0)) % BLS_MODULUS for i in range(len(a))] + length_a = len(a) + length_b = len(b) + return [(a[i] + (b[i] if i < length_b else 0)) % BLS_MODULUS for i in range(length_a)] ``` #### `neg_polynomialcoeff`