From 5aad1242b389d835c696ec8203255b4944332835 Mon Sep 17 00:00:00 2001 From: Matthew Gordon Date: Sat, 4 Jul 2020 21:16:28 -0400 Subject: [PATCH] For simple_scene benchmark, regerenerate BVH periodically This makes the results much more consistent run-to-run. I suspect the inconsistency was caused by random variations in the memory layout of the BVH. --- benches/simple_scene.rs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/benches/simple_scene.rs b/benches/simple_scene.rs index 2a10d0f..36256b3 100644 --- a/benches/simple_scene.rs +++ b/benches/simple_scene.rs @@ -20,22 +20,21 @@ fn simple_scene(bencher: &mut Criterion) { let model_file_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("test_data/stanford_bunny.obj"); - let scene = Scene { - camera_location: Point3::new(-2.0, 1.0, -5.0), - objects: vec![Box::new(BoundingVolumeHierarchy::build( - load_obj( - &model_file_path, - Arc::new(ReflectiveMaterial { - colour: ColourRgbF::from_named(NamedColour::Yellow), - diffuse_strength: 0.05, - reflection_strength: 0.9, - }), - ) - .unwrap(), - ))], - }; - bencher.bench_function("simple_scene", |b| { + let scene = Scene { + camera_location: Point3::new(-2.0, 1.0, -5.0), + objects: vec![Box::new(BoundingVolumeHierarchy::build( + load_obj( + &model_file_path, + Arc::new(ReflectiveMaterial { + colour: ColourRgbF::from_named(NamedColour::Yellow), + diffuse_strength: 0.05, + reflection_strength: 0.9, + }), + ) + .unwrap(), + ))], + }; b.iter(|| { let tile = Tile { start_column: 0,