mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-14 07:21:51 +00:00
test chunks pool
This commit is contained in:
parent
5fdb71c47b
commit
5317106d81
1 changed files with 5 additions and 1 deletions
|
|
@ -90,6 +90,9 @@ static inline auto load_inventories(
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "util/timeutil.hpp"
|
#include "util/timeutil.hpp"
|
||||||
|
#include "util/ObjectsPool.hpp"
|
||||||
|
|
||||||
|
static util::ObjectsPool<Chunk> chunks_pool(1'024);
|
||||||
|
|
||||||
std::shared_ptr<Chunk> GlobalChunks::create(int x, int z) {
|
std::shared_ptr<Chunk> GlobalChunks::create(int x, int z) {
|
||||||
const auto& found = chunksMap.find(keyfrom(x, z));
|
const auto& found = chunksMap.find(keyfrom(x, z));
|
||||||
|
|
@ -100,7 +103,8 @@ std::shared_ptr<Chunk> GlobalChunks::create(int x, int z) {
|
||||||
std::shared_ptr<Chunk> chunk;
|
std::shared_ptr<Chunk> chunk;
|
||||||
{
|
{
|
||||||
timeutil::ScopeLogTimer log(555);
|
timeutil::ScopeLogTimer log(555);
|
||||||
chunk = std::make_shared<Chunk>(x, z);
|
// chunk = std::make_shared<Chunk>(x, z);
|
||||||
|
chunk = chunks_pool.create(x, z);
|
||||||
}
|
}
|
||||||
chunksMap[keyfrom(x, z)] = chunk;
|
chunksMap[keyfrom(x, z)] = chunk;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue