mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
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
This commit is contained in:
parent
9a17b65f26
commit
3e50850260
5 changed files with 14 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue