cfg out benches for wasm32
This commit is contained in:
@@ -1,10 +1,14 @@
|
|||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
|
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
use pprof::criterion::{Output, PProfProfiler};
|
use pprof::criterion::{Output, PProfProfiler};
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
mod setup;
|
mod setup;
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
fn bench_criterion(c: &mut Criterion) {
|
fn bench_criterion(c: &mut Criterion) {
|
||||||
for (&name, bench) in setup::prolog_benches().iter() {
|
for (&name, bench) in setup::prolog_benches().iter() {
|
||||||
match bench.strategy {
|
match bench.strategy {
|
||||||
@@ -15,7 +19,7 @@ fn bench_criterion(c: &mut Criterion) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
fn config() -> Criterion {
|
fn config() -> Criterion {
|
||||||
Criterion::default()
|
Criterion::default()
|
||||||
@@ -28,9 +32,15 @@ fn config() -> Criterion {
|
|||||||
Criterion::default().sample_size(20)
|
Criterion::default().sample_size(20)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
criterion_group!(
|
criterion_group!(
|
||||||
name = benches;
|
name = benches;
|
||||||
config = config();
|
config = config();
|
||||||
targets = bench_criterion
|
targets = bench_criterion
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
criterion_main!(benches);
|
criterion_main!(benches);
|
||||||
|
|
||||||
|
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
|
||||||
|
fn main() {}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
use iai_callgrind::{library_benchmark, library_benchmark_group, main};
|
use iai_callgrind::{library_benchmark, library_benchmark_group, main};
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
use scryer_prolog::machine::parsed_results::QueryResolution;
|
use scryer_prolog::machine::parsed_results::QueryResolution;
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
mod setup;
|
mod setup;
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
#[library_benchmark]
|
#[library_benchmark]
|
||||||
#[bench::count_edges(setup::prolog_benches()["count_edges"].setup())]
|
#[bench::count_edges(setup::prolog_benches()["count_edges"].setup())]
|
||||||
#[bench::numlist(setup::prolog_benches()["numlist"].setup())]
|
#[bench::numlist(setup::prolog_benches()["numlist"].setup())]
|
||||||
@@ -11,8 +15,13 @@ fn bench(mut run: impl FnMut() -> QueryResolution) -> QueryResolution {
|
|||||||
run()
|
run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
library_benchmark_group!(
|
library_benchmark_group!(
|
||||||
name = benches;
|
name = benches;
|
||||||
benchmarks = bench
|
benchmarks = bench
|
||||||
);
|
);
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
main!(library_benchmark_groups = benches);
|
main!(library_benchmark_groups = benches);
|
||||||
|
|
||||||
|
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
|
||||||
|
fn main() {}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ impl PrologBenchmark {
|
|||||||
machine
|
machine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
|
||||||
pub fn setup(&self) -> impl FnMut() -> QueryResolution {
|
pub fn setup(&self) -> impl FnMut() -> QueryResolution {
|
||||||
let mut machine = self.make_machine();
|
let mut machine = self.make_machine();
|
||||||
let query = self.query;
|
let query = self.query;
|
||||||
|
|||||||
Reference in New Issue
Block a user