From 3e84bb0669767e4bacd40f088cfb9f601fe6a292 Mon Sep 17 00:00:00 2001 From: Imbris Date: Fri, 8 Oct 2021 11:43:09 -0400 Subject: [PATCH] Try marking VolGrid2d::for_each_in and friends as inlineable --- common/src/volumes/vol_grid_2d.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/src/volumes/vol_grid_2d.rs b/common/src/volumes/vol_grid_2d.rs index ddb4167a18..ae5849fe41 100644 --- a/common/src/volumes/vol_grid_2d.rs +++ b/common/src/volumes/vol_grid_2d.rs @@ -56,6 +56,7 @@ impl ReadVol for VolGrid2d { // /// Call provided closure with each block in the supplied Aabb // /// Areas outside loaded chunks are ignored + #[inline(always)] fn for_each_in(&self, aabb: Aabb, mut f: impl FnMut(Vec3, Self::Vox)) where Self::Vox: Copy, @@ -151,7 +152,7 @@ impl VolGrid2d { } } - //#[inline] + #[inline(always)] pub fn chunk_size() -> Vec2 { V::RECT_SIZE } //#[inline] @@ -159,7 +160,7 @@ impl VolGrid2d { self.chunks.insert(key, chunk) } - //#[inline] + #[inline(always)] pub fn get_key(&self, key: Vec2) -> Option<&V> { self.chunks.get(&key).map(|arc_chunk| arc_chunk.as_ref()) } @@ -174,10 +175,10 @@ impl VolGrid2d { //#[inline] pub fn remove(&mut self, key: Vec2) -> Option> { self.chunks.remove(&key) } - //#[inline] + #[inline(always)] pub fn key_pos(&self, key: Vec2) -> Vec2 { key * V::RECT_SIZE.map(|e| e as i32) } - //#[inline] + #[inline(always)] pub fn pos_key(&self, pos: Vec3) -> Vec2 { Self::chunk_key(pos) } //#[inline]