Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rand_core_0_9 = ["dep:rand_core_0_9"]
rand_0_10 = ["rand_core_0_10", "dep:rand_0_10"]
rand_core_0_10 = ["dep:rand_core_0_10"]
serde = ["dep:serde"]
bench-internals = []

[package.metadata.docs.rs]
features = ["std", "serde", "rand_0_10", "rand_0_9", "quickcheck", "arbitrary"]
Expand All @@ -47,6 +48,10 @@ required-features = ["rand_0_10"]
harness = false
name = "shootout-pidigits"

[[bench]]
name = "ntt_plan"
required-features = ["bench-internals"]

[dependencies]

[dependencies.num-integer]
Expand Down
55 changes: 55 additions & 0 deletions benches/ntt_plan.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#![feature(test)]

extern crate test;

// Run with: cargo bench --bench ntt_plan --features bench-internals

use num_bigint::__benchmark_ntt_plan_build;
use test::{black_box, Bencher};

macro_rules! ntt_plan_bench {
($name:ident, $prime:expr, $exponent:expr) => {
#[bench]
fn $name(bencher: &mut Bencher) {
let min_len = 1usize << $exponent;
bencher.iter(|| black_box(__benchmark_ntt_plan_build::<$prime>(black_box(min_len))));
}
};
}

ntt_plan_bench!(p1_2_09, 1, 9);
ntt_plan_bench!(p1_2_10, 1, 10);
ntt_plan_bench!(p1_2_11, 1, 11);
ntt_plan_bench!(p1_2_12, 1, 12);
ntt_plan_bench!(p1_2_13, 1, 13);
ntt_plan_bench!(p1_2_14, 1, 14);
ntt_plan_bench!(p1_2_15, 1, 15);
ntt_plan_bench!(p1_2_16, 1, 16);
ntt_plan_bench!(p1_2_17, 1, 17);
ntt_plan_bench!(p1_2_18, 1, 18);
ntt_plan_bench!(p1_2_19, 1, 19);
ntt_plan_bench!(p1_2_20, 1, 20);
ntt_plan_bench!(p2_2_09, 2, 9);
ntt_plan_bench!(p2_2_10, 2, 10);
ntt_plan_bench!(p2_2_11, 2, 11);
ntt_plan_bench!(p2_2_12, 2, 12);
ntt_plan_bench!(p2_2_13, 2, 13);
ntt_plan_bench!(p2_2_14, 2, 14);
ntt_plan_bench!(p2_2_15, 2, 15);
ntt_plan_bench!(p2_2_16, 2, 16);
ntt_plan_bench!(p2_2_17, 2, 17);
ntt_plan_bench!(p2_2_18, 2, 18);
ntt_plan_bench!(p2_2_19, 2, 19);
ntt_plan_bench!(p2_2_20, 2, 20);
ntt_plan_bench!(p3_2_09, 3, 9);
ntt_plan_bench!(p3_2_10, 3, 10);
ntt_plan_bench!(p3_2_11, 3, 11);
ntt_plan_bench!(p3_2_12, 3, 12);
ntt_plan_bench!(p3_2_13, 3, 13);
ntt_plan_bench!(p3_2_14, 3, 14);
ntt_plan_bench!(p3_2_15, 3, 15);
ntt_plan_bench!(p3_2_16, 3, 16);
ntt_plan_bench!(p3_2_17, 3, 17);
ntt_plan_bench!(p3_2_18, 3, 18);
ntt_plan_bench!(p3_2_19, 3, 19);
ntt_plan_bench!(p3_2_20, 3, 20);
6 changes: 6 additions & 0 deletions src/biguint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ mod convert;
mod iter;
mod monty;
mod ntt;

#[cfg(feature = "bench-internals")]
#[doc(hidden)]
pub fn __benchmark_ntt_plan_build<const PRIME: usize>(min_len: usize) -> (usize, usize, usize) {
ntt::benchmark_plan_build::<PRIME>(min_len)
}
mod power;
mod roots;
mod serde;
Expand Down
Loading
Loading