Merge branch 'xMAC94x/cleanupbenches' into 'master'

use criterion groups and fix tracing to much on wgpu

See merge request veloren/veloren!2369
This commit is contained in:
Marcel 2021-06-03 21:43:46 +00:00
commit 59ae5ec573
3 changed files with 14 additions and 10 deletions

View File

@ -33,7 +33,9 @@ fn criterion_benchmark(c: &mut Criterion) {
.unwrap();
}
c.bench_function("chunk: full read", |b| {
let mut c = c.benchmark_group("chunk");
c.bench_function("full read", |b| {
b.iter(|| {
for (_, vox) in chunk.vol_iter(
Vec3::new(0, 0, MIN_Z),
@ -48,7 +50,7 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});
c.bench_function("chunk: constrained read", |b| {
c.bench_function("constrained read", |b| {
b.iter(|| {
for (_, vox) in
chunk.vol_iter(Vec3::new(9, 13, 2 + MIN_Z), Vec3::new(26, 30, -13 + MAX_Z))
@ -58,7 +60,7 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});
c.bench_function("chunk: local read", |b| {
c.bench_function("local read", |b| {
b.iter(|| {
for (_, vox) in
chunk.vol_iter(Vec3::new(9, 13, 2 + MIN_Z), Vec3::new(14, 18, 7 + MIN_Z))
@ -68,7 +70,7 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});
c.bench_function("chunk: X-direction read", |b| {
c.bench_function("X-direction read", |b| {
b.iter(|| {
for (_, vox) in
chunk.vol_iter(Vec3::new(9, 13, 2 + MIN_Z), Vec3::new(26, 14, 3 + MIN_Z))
@ -78,7 +80,7 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});
c.bench_function("chunk: Y-direction read", |b| {
c.bench_function("Y-direction read", |b| {
b.iter(|| {
for (_, vox) in
chunk.vol_iter(Vec3::new(9, 13, 2 + MIN_Z), Vec3::new(10, 30, 3 + MIN_Z))
@ -88,7 +90,7 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});
c.bench_function("chunk: Z-direction read", |b| {
c.bench_function("Z-direction read", |b| {
b.iter(|| {
for (_, vox) in
chunk.vol_iter(Vec3::new(9, 13, 2 + MIN_Z), Vec3::new(10, 14, 19 + MIN_Z))
@ -98,7 +100,7 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});
c.bench_function("chunk: long Z-direction read", |b| {
c.bench_function("long Z-direction read", |b| {
b.iter(|| {
for (_, vox) in
chunk.vol_iter(Vec3::new(9, 13, 2 + MIN_Z), Vec3::new(10, 14, -13 + MAX_Z))
@ -108,7 +110,7 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});
c.bench_function("chunk: full write (dense)", |b| {
c.bench_function("full write (dense)", |b| {
b.iter(|| {
for pos in chunk.pos_iter(
Vec3::new(0, 0, MIN_Z),

View File

@ -4,12 +4,13 @@ use vek::*;
use veloren_common::util::{linear_to_srgb, srgb_to_linear};
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("color: srgb to linear (0.5, 0.1, 0.5)", |b| {
let mut c = c.benchmark_group("color");
c.bench_function("srgb to linear (0.5, 0.1, 0.5)", |b| {
b.iter(|| {
black_box(srgb_to_linear(black_box(Rgb::new(0.5, 0.1, 0.5))));
})
});
c.bench_function("color: linear to srgb (0.5, 0.1, 0.5)", |b| {
c.bench_function("linear to srgb (0.5, 0.1, 0.5)", |b| {
b.iter(|| {
black_box(linear_to_srgb(black_box(Rgb::new(0.5, 0.1, 0.5))));
})

View File

@ -57,6 +57,7 @@ where
.add_directive("h2=info".parse().unwrap())
.add_directive("tokio_util=info".parse().unwrap())
.add_directive("rustls=info".parse().unwrap())
.add_directive("wgpu_core=info".parse().unwrap())
.add_directive("wgpu_core::device=warn".parse().unwrap())
.add_directive("veloren_network_protocol=info".parse().unwrap())
.add_directive("quinn_proto::connection=info".parse().unwrap())