cargo upgrade -p criterion
This commit is contained in:
@@ -13,21 +13,21 @@ name = "spheres"
|
||||
chrono = "*"
|
||||
core_affinity = "0.5"
|
||||
cpuprofiler = { version = "0.0.3", optional = true }
|
||||
image = "0.22.3"
|
||||
lazy_static = "1.1.0"
|
||||
log = "0.4.5"
|
||||
num_cpus = "1.8.0"
|
||||
rand = "0.8.3"
|
||||
serde = "1.0.79"
|
||||
serde_derive = "1.0.79"
|
||||
serde_json = "1.0.41"
|
||||
structopt = "0.2.10"
|
||||
image = "0.22.5"
|
||||
lazy_static = "1.4.0"
|
||||
log = "0.4.17"
|
||||
num_cpus = "1.15.0"
|
||||
rand = "0.8.5"
|
||||
serde = "1.0.152"
|
||||
serde_derive = "1.0.152"
|
||||
serde_json = "1.0.91"
|
||||
structopt = "0.2.18"
|
||||
vec3 = {path = "../vec3"}
|
||||
stl = {path = "../../../stl"}
|
||||
#stl = {git = "https://git-private.z.xinu.tv/wathiede/stl"}
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.2"
|
||||
criterion = "0.4"
|
||||
|
||||
[features]
|
||||
profile = ["cpuprofiler"]
|
||||
|
||||
18
rtiow/renderer/benches/aabb.rs
Normal file
18
rtiow/renderer/benches/aabb.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use criterion::*;
|
||||
|
||||
fn decode(bytes: &[u8]) {
|
||||
// Decode the bytes
|
||||
//...
|
||||
}
|
||||
|
||||
fn bench(c: &mut Criterion) {
|
||||
let bytes: &[u8] = b"some bytes";
|
||||
|
||||
let mut group = c.benchmark_group("throughput-example");
|
||||
group.throughput(Throughput::Bytes(bytes.len() as u64));
|
||||
group.bench_function("decode", |b| b.iter(|| decode(bytes)));
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench);
|
||||
criterion_main!(benches);
|
||||
@@ -1,7 +1,7 @@
|
||||
#[macro_use]
|
||||
extern crate criterion;
|
||||
|
||||
use criterion::{Criterion, ParameterizedBenchmark};
|
||||
use criterion::*;
|
||||
|
||||
use renderer::{
|
||||
hitable::Hit, material::Lambertian, ray::Ray, sphere::Sphere, texture::ConstantTexture,
|
||||
@@ -20,14 +20,15 @@ fn criterion_benchmark(c: &mut Criterion) {
|
||||
// Miss
|
||||
Ray::new([0., 0., -2.], [0., 0., -1.], 0.),
|
||||
];
|
||||
c.bench(
|
||||
"sphere",
|
||||
ParameterizedBenchmark::new(
|
||||
"Sphere",
|
||||
move |b, r| b.iter(|| sphere.hit(*r, 0., 1.)),
|
||||
rays,
|
||||
),
|
||||
);
|
||||
let mut group = c.benchmark_group("sphere");
|
||||
for r in rays {
|
||||
group.bench_with_input(
|
||||
BenchmarkId::new("Sphere", format!("{:?}", r)),
|
||||
&r,
|
||||
|b, r| b.iter(|| sphere.hit(*r, 0., 1.)),
|
||||
);
|
||||
}
|
||||
group.finish()
|
||||
}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
|
||||
Reference in New Issue
Block a user