cargo upgrade -p criterion

This commit is contained in:
Bill Thiede 2023-01-21 16:10:13 -08:00
parent 4506418706
commit 27d6c1280b
7 changed files with 389 additions and 249 deletions

539
rtiow/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,14 +7,14 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = "0.7.8"
askama = "0.7.1"
image = "0.22.3"
log = "0.4.5"
rand = "0.8.3"
actix-web = "0.7.19"
askama = "0.7.2"
image = "0.22.5"
log = "0.4.17"
rand = "0.8.5"
rand_xorshift = "0.3.0"
renderer = { path = "../renderer" }
serde = "1.0.79"
serde_derive = "1.0.79"
stderrlog = "0.4.1"
structopt = "0.2.10"
serde = "1.0.152"
serde_derive = "1.0.152"
stderrlog = "0.4.3"
structopt = "0.2.18"

View File

@ -7,13 +7,13 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
askama = "0.7.1"
image = "0.22.3"
log = "0.4.5"
rand = "0.5.5"
askama = "0.7.2"
image = "0.22.5"
log = "0.4.17"
rand = "0.5.6"
renderer = { path = "../renderer" }
serde = "1.0.79"
serde_derive = "1.0.79"
stderrlog = "0.4.1"
structopt = "0.2.10"
warp = "0.1.20"
serde = "1.0.152"
serde_derive = "1.0.152"
stderrlog = "0.4.3"
structopt = "0.2.18"
warp = "0.1.23"

View File

@ -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"]

View 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);

View File

@ -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,15 +20,16 @@ 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);
criterion_main!(benches);

View File

@ -7,7 +7,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
log = "0.4.5"
log = "0.4.17"
renderer = { path = "../renderer" }
stderrlog = "0.4.1"
structopt = "0.2.10"
stderrlog = "0.4.3"
structopt = "0.2.18"