Skip to content

Commit

Permalink
Improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-chuang committed Mar 30, 2021
1 parent 695ccc8 commit 8d7ddfb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions poly/src/domain/radix2/fft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,16 @@ impl<F: FftField> Radix2EvaluationDomain<F> {

fn oi_helper<T: DomainCoeff<F>>(&self, xi: &mut [T], root: F) {
let roots_cache = self.roots_of_unity(root);
let compaction_size = core::cmp::min(

// The `cmp::min` is only necessary for the case where
// `MIN_NUM_CHUNKS_FOR_COMPACTION = 1`. Else, notice that we compact
// the roots cache by a stride of at least `MIN_NUM_CHUNKS_FOR_COMPACTION`.

let compaction_max_size = core::cmp::min(
roots_cache.len() / 2,
roots_cache.len() / MIN_NUM_CHUNKS_FOR_COMPACTION,
);
let mut compacted_roots = vec![F::default(); compaction_size];
let mut compacted_roots = vec![F::default(); compaction_max_size];

#[cfg(feature = "parallel")]
let max_threads = rayon::current_num_threads();
Expand Down Expand Up @@ -277,7 +282,7 @@ impl<F: FftField> Radix2EvaluationDomain<F> {

/// The minimum number of chunks at which root compaction
/// is beneficial.
const MIN_NUM_CHUNKS_FOR_COMPACTION: usize = 1 << 30;
const MIN_NUM_CHUNKS_FOR_COMPACTION: usize = 1 << 7;
const MIN_GAP_SIZE_FOR_PARALLELISATION: usize = 1 << 10;

// minimum size at which to parallelize.
Expand Down

0 comments on commit 8d7ddfb

Please sign in to comment.