eq(x, y) appears throughout Jolt’s sumcheck protocols. Optimized evaluation of EQ polynomials is critical for prover performance, as these operations are executed thousands of times per proof.
Equality Polynomial Definition
The equality polynomial over boolean hypercube is:eq(x, y) = 1whenx = y(over ⁿ)eq(x, y) = 0whenx ≠ y- Multilinear in both arguments
Multilinear Extension (MLE)
The MLE ofeq extends the definition to field elements:
Common Operations
1. EQ Evaluation Table
Computeeq(r, x) for all x ∈ {0,1}ⁿ:
2^n where evals[i] = eq(r, i) (big-endian bit order).
Use case: Pre-compute EQ table for sumcheck evaluations.
2. Zero Selector
Computeeq(r, 0) = ∏ᵢ (1 - rᵢ):
3. Cached Evaluations
Compute EQ tables for all prefixes ofr:
result[j][x] = eq(r[..j], x) for all j ∈ [0, n].
Use case: Incremental sumcheck binding where intermediate EQ values are needed.
Key Optimizations
1. Serial vs. Parallel Threshold
Small EQ tables use serial computation:n ≤ 16 (table size ≤ 65,536).
2. Serial Evaluation Algorithm
Dynamic programming approach:3. Parallel Evaluation Algorithm
For large tables, use rayon parallelization:- Unsafe pre-allocation for zero-initialized vector
- Parallel iteration over pairs
- In-place updates (no intermediate allocations)
4. Aligned Block Evaluation
Compute EQ values for a power-of-two block:5. Endianness Handling
EQ polynomial evaluation with different bit orderings:Performance Impact
Memory Allocation Optimization
Standard approach:n (avoids Drop overhead).
Parallelization Impact
| Table Size | Serial Time | Parallel Time | Speedup |
|---|---|---|---|
| 2^10 (1K) | 10 μs | 15 μs | 0.67x (overhead) |
| 2^16 (64K) | 800 μs | 250 μs | 3.2x |
| 2^20 (1M) | 15 ms | 2.5 ms | 6x |
| 2^24 (16M) | 250 ms | 30 ms | 8.3x |
Caching Benefits
For protocols that need EQ values at multiple prefix lengths: Without caching:- Time complexity: O(2^0 + 2^1 + … + 2^n) = O(2^(n+1))
- Time complexity: O(2^n) — 2x speedup
Usage in Jolt
Sumcheck Round Polynomial
EQ polynomials appear in every sumcheck round:Split EQ Evaluation
CompactPolynomial optimizes this pattern:SharedRaPolynomials
Multiple polynomials share the same EQ table:Best Practices
1. Choose Appropriate Evaluation Method
2. Reuse EQ Tables
Avoid recomputing:3. Use Aligned Blocks for Sparse Access
When accessing a contiguous range:Related Optimizations
- CompactPolynomial: Split EQ evaluation
- Batched Sumcheck: Uses EQ polynomials in every round
- SharedRaPolynomials: Share EQ tables across polynomials
References
- Implementation:
jolt-core/src/poly/eq_poly.rs - Index/bit ordering: Big-endian convention (MSB = r[0], LSB = r[n-1])