From 68fba19fc6ed0ee2b1a17a30b33d5af2cd9af72d Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sat, 29 Jun 2019 09:46:39 +0900 Subject: [PATCH] Removed a timer from a hot loop, and fixed node-test stat. Gives I small performance boost, and now ray/node tests are actually reported correctly. Yay! --- src/accel/bvh4.rs | 13 +------------ src/main.rs | 4 ---- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/accel/bvh4.rs b/src/accel/bvh4.rs index e5298e7..7b67540 100644 --- a/src/accel/bvh4.rs +++ b/src/accel/bvh4.rs @@ -104,8 +104,6 @@ impl<'a> BVH4<'a> { return; } - let mut timer = Timer::new(); - let mut trav_time: f64 = 0.0; let mut node_tests: u64 = 0; let traversal_table = @@ -116,13 +114,13 @@ impl<'a> BVH4<'a> { let mut stack_ptr = 1; while stack_ptr > 0 { - node_tests += ray_stack.ray_count_in_next_task() as u64; match node_stack[stack_ptr] { &BVH4Node::Internal { bounds, children, traversal_code, } => { + node_tests += ray_stack.ray_count_in_next_task() as u64; let mut all_hits = Bool4::new_false(); // Ray testing @@ -163,23 +161,14 @@ impl<'a> BVH4<'a> { } &BVH4Node::Leaf { object_range } => { - trav_time += timer.tick() as f64; - // Do the ray tests. obj_ray_test(object_range.0..object_range.1, rays, ray_stack); - timer.tick(); - stack_ptr -= 1; } } } - trav_time += timer.tick() as f64; - ACCEL_TRAV_TIME.with(|att| { - let v = att.get(); - att.set(v + trav_time); - }); ACCEL_NODE_RAY_TESTS.with(|anv| { let v = anv.get(); anv.set(v + node_tests); diff --git a/src/main.rs b/src/main.rs index 753e074..f469e98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -297,10 +297,6 @@ fn main() { "\t\t\tRays/sec: {}", (rstats.ray_count as f64 / (ntime * rstats.trace_time) as f64) as u64 ); - println!( - "\t\t\tTraversal: {:.3}s", - ntime * rstats.accel_traversal_time - ); println!("\t\t\tRay/node tests: {}", rstats.accel_node_visits); println!( "\t\tInitial ray generation: {:.3}s",