From f35581506c2bbbe9fce8c294aaf30d24b6a8088a Mon Sep 17 00:00:00 2001 From: David Williams Date: Sun, 12 Apr 2015 09:42:15 +0200 Subject: [PATCH] Minor optimization - only creating vector if we are going to use it. --- include/PolyVox/PagedVolume.inl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/PolyVox/PagedVolume.inl b/include/PolyVox/PagedVolume.inl index 124fbb16..9bcb3f10 100644 --- a/include/PolyVox/PagedVolume.inl +++ b/include/PolyVox/PagedVolume.inl @@ -270,8 +270,6 @@ namespace PolyVox template typename PagedVolume::Chunk* PagedVolume::getChunk(int32_t uChunkX, int32_t uChunkY, int32_t uChunkZ) const { - Vector3DInt32 v3dChunkPos(uChunkX, uChunkY, uChunkZ); - // The chunk was not the same as last time, but we can now hope it is in the set of most recently used chunks. /*Chunk* pChunk = nullptr; auto itChunk = m_mapChunks.find(v3dChunkPos); @@ -328,6 +326,7 @@ namespace PolyVox if (!pChunk) { // The chunk was not found so we will create a new one. + Vector3DInt32 v3dChunkPos(uChunkX, uChunkY, uChunkZ); pChunk = new PagedVolume::Chunk(v3dChunkPos, m_uChunkSideLength, m_pPager); pChunk->m_uChunkLastAccessed = ++m_uTimestamper; // Important, as we may soon delete the oldest chunk //m_mapChunks.insert(std::make_pair(v3dChunkPos, std::unique_ptr(pChunk)));