Skip to content

Commit

Permalink
perf: multiply by zerofier after fold
Browse files Browse the repository at this point in the history
  • Loading branch information
Oppen committed Dec 13, 2023
1 parent 6063197 commit 89b7487
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions provers/stark/src/constraints/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,23 +201,19 @@ impl<F: IsFFTField> ConstraintEvaluator<F> {
// Add each term of the transition constraints to the
// composition polynomial, including the zerofier, the
// challenge and the exemption polynomial if it is necessary.
let acc_transition = evaluations_transition
let acc_transition = zerofier * evaluations_transition
.iter()
.zip(&air.context().transition_exemptions)
.zip(transition_coefficients)
.fold(FieldElement::zero(), |acc, ((eval, exemption), beta)| {
#[cfg(feature = "parallel")]
let zerofier = zerofier.clone();

// If there's no exemption, then
// the zerofier remains as it was.
if *exemption == 0 {
acc + zerofier * beta * eval
acc + beta * eval
} else {
//TODO: change how exemptions are indexed!
if num_exemptions == 1 {
acc + zerofier
* beta
acc + beta
* eval
* &transition_exemptions_evaluations[0][i]
} else {
Expand All @@ -235,8 +231,7 @@ impl<F: IsFFTField> ConstraintEvaluator<F> {
.position(|elem_2| elem_2 == exemption)
.expect("is there");

acc + zerofier
* beta
acc + beta
* eval
* &transition_exemptions_evaluations[index][i]
}
Expand Down

0 comments on commit 89b7487

Please sign in to comment.