summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-07-26 20:12:48 +0200
committerGitHub <noreply@github.com>2017-07-26 20:12:48 +0200
commit3e50850260db13ec63ce4ca0e47e7fd7e30ce484 (patch)
treeeb07ce2418ad29152db2378dd9e75fb873cdafd4 /src/client
parent9a17b65f26eea5b9d7176e7df205f72ed2ff6c0f (diff)
downloadminetest-3e50850260db13ec63ce4ca0e47e7fd7e30ce484.tar.gz
minetest-3e50850260db13ec63ce4ca0e47e7fd7e30ce484.tar.bz2
minetest-3e50850260db13ec63ce4ca0e47e7fd7e30ce484.zip
TileLayer: use shared_ptr for FrameSpec vector (#6171)
* TileLayer: use shared_ptr for vector framespec This reduce memory copy of TileLayer from (4 to 16) * FrameSpec where FrameSpec = (sizeof(int) + 3 * sizeof(ptr)) to int + sizeof(ptr) Callgrind difference Before: https://lut.im/RGkiJqQb8T/LeQIEXpAuRzfl7gd.png After: https://lut.im/bcqmwee1xu/cTwtptY5tRuS9lp0.png * Fix one push_back to use vector::emplace_back & optimize inclusions
Diffstat (limited to 'src/client')
-rw-r--r--src/client/tile.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/client/tile.h b/src/client/tile.h
index aadc3e156..cfdcf30bd 100644
--- a/src/client/tile.h
+++ b/src/client/tile.h
@@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <string>
#include <vector>
#include <SMaterial.h>
+#include <memory>
#include "util/numeric.h"
class IGameDef;
@@ -284,7 +285,7 @@ struct TileLayer
//! If true, the tile has its own color.
bool has_color = false;
- std::vector<FrameSpec> frames;
+ std::shared_ptr<std::vector<FrameSpec>> frames = nullptr;
/*!
* The color of the tile, or if the tile does not own