benchmark fixes

This commit is contained in:
proller committed 2026-01-07 21:54:05 +01:00
1 parent 653d48b356
commit 3fba6cc78f
6 files changed
+30 -11

No files matched your search

+4 -4
View File
@@ -55,9 +55,9 @@ void benchGetObjectsInsideRadius(Catch::Benchmark::Chronometer &meter)
{
server::ActiveObjectMgr mgr;
size_t x;
std::vector<ServerActiveObject*> result;
std::vector<ServerActiveObjectPtr> result;
auto cb = [&x] (ServerActiveObject *obj) -> bool {
auto cb = [&x] (const ServerActiveObjectPtr &obj) -> bool {
x += obj->m_static_exists ? 0 : 1;
return false;
};
@@ -77,9 +77,9 @@ void benchGetObjectsInArea(Catch::Benchmark::Chronometer &meter)
{
server::ActiveObjectMgr mgr;
size_t x;
std::vector<ServerActiveObject*> result;
std::vector<ServerActiveObjectPtr> result;
auto cb = [&x] (ServerActiveObject *obj) -> bool {
auto cb = [&x] (const ServerActiveObjectPtr &obj) -> bool {
x += obj->m_static_exists ? 0 : 1;
return false;
};
+4 -2
View File
@@ -18,16 +18,18 @@ public:
s16 block_y = p.Y;
MapSector *sector = getSectorNoGenerate(p2d);
/*
if (!sector) {
sector = new MapSector(this, p2d, m_gamedef);
m_sectors[p2d] = sector;
}
*/
MapBlock *block = sector->getBlockNoCreateNoEx(block_y);
MapBlock *block = sector->getBlockNoCreateNoEx(p /*block_y*/);
if (block)
return block;
return sector->createBlankBlock(block_y);
return sector->createBlankBlock(p).get();
}
};
+1 -1
View File
@@ -35,7 +35,7 @@ static void workOnMetadata(const MBContainer &vec)
{
for (MapBlock *block : vec) {
#if CHECK_CLIENT_BUILD()
bool foo = !!block->mesh;
bool foo = !!block->getLodMesh(0);
#else
bool foo = true;
#endif
+4 -1
View File
@@ -75,9 +75,11 @@ void Map::dispatchEvent(const MapEditEvent &event)
}
}
/*
MapSector * Map::getSectorNoGenerateNoLock(v2s16 p)
{
return this;
/*
if(m_sector_cache != NULL && p == m_sector_cache_p){
MapSector * sector = m_sector_cache;
return sector;
@@ -95,6 +97,7 @@ MapSector * Map::getSectorNoGenerateNoLock(v2s16 p)
m_sector_cache = sector;
return sector;
*/
}
MapSector *Map::getSectorNoGenerate(v2s16 p)
+15 -2
View File
@@ -9,11 +9,9 @@
#include <set>
#include <map>
#include "irr_v3d.h"
#include "threading/concurrent_set.h"
#include "threading/concurrent_unordered_map.h"
#include "threading/concurrent_unordered_set.h"
#include "util/unordered_map_hash.h"
#include <list>
#include "irrlichttypes_bloated.h"
#include "mapblock.h"
@@ -121,6 +119,8 @@ public:
class Map : public NodeContainer
{
public:
using MapSector = Map;
Map(IGameDef *gamedef);
virtual ~Map();
DISABLE_CLASS_COPY(Map);
@@ -130,6 +130,17 @@ public:
// event shall be deleted by caller after the call.
void dispatchEvent(const MapEditEvent &event);
// On failure returns NULL
MapSector * getSectorNoGenerateNoLock(v2s16 p2d);
// Same as the above (there exists no lock anymore)
MapSector * getSectorNoGenerate(v2s16 p2d);
/*
This is overloaded by ClientMap and ServerMap to allow
their differing fetch methods.
*/
virtual MapSector * emergeSector(v2s16 p){ return NULL; }
// Returns InvalidPositionException if not found
MapBlock * getBlockNoCreate(v3s16 p);
// Returns NULL if not found
@@ -460,3 +471,5 @@ protected:
public:
Map *m_map = nullptr;
};
using MapSector = Map::MapSector;
+2 -1
View File
@@ -85,6 +85,7 @@ $0 -mg_name=earth -mg_earth='{"center":{"z":36.822183, "y":0, "x":30.583390}}' b
$0 -mg_name=earth -mg_earth='{"scale":{"z":10000, "y":100, "x":10000}}' bot
$0 -mg_name=earth -mg_earth='{"center":{"z":27.9878279,"y":0,"x":86.923833}}' -static_spawnpoint='(130,8842,56)' bot # Everest
$0 -mg_name=earth -mg_earth='{"center":{"z":22.28422,"x":114.15996,"y":0} }' bot # HongKong
$0 -mg_name=earth -static_spawnpoint='(12709494,35,2484615)' bot # HongKong
$0 ---cmake_minetest=1 ---build_name=_minetest ----headless ----headless_optimize --address=cool.server.org --port=30001 ---clients_num=25 clients
@@ -404,7 +405,7 @@ $commands = {
cmake_prepare => sub {
$config->{cmake_clang} //= 1 if $config->{clang_version};
$config->{clang_version} = $config->{cmake_clang} if $config->{cmake_clang} and $config->{cmake_clang} ne '1';
$config->{cmake_libcxx} //= 1 if $config->{cmake_clang};
# TODO: fix boost and enable: $config->{cmake_libcxx} //= 1 if $config->{cmake_clang};
$g->{build_names}{x_clang} = $config->{clang_version} if $config->{cmake_clang};
my $build_dir = $commands->{build_dir}();
chdir $config->{root_path};