Luanti 5.16.0-dev
Loading...
Searching...
No Matches
benchmark_mapmodify.cpp File Reference
#include "catch.h"
#include "util/container.h"
Include dependency graph for benchmark_mapmodify.cpp:

Macros

#define BENCH_ITERATE_(_label, _count, _best)
#define BENCH_ITERATE(_count)
#define BENCH_REMOVE(_count)

Typedefs

using TestMap = ModifySafeMap<u16, void*>

Functions

static void fill (TestMap &map, size_t n)
static void pollute (TestMap &map)
static void remove (TestMap &map, size_t offset, size_t count)
 TEST_CASE ("ModifySafeMap")

Macro Definition Documentation

◆ BENCH_ITERATE

#define BENCH_ITERATE ( _count)
Value:
BENCH_ITERATE_("iterate_" #_count, _count, 0) \
BENCH_ITERATE_("iterate_bestcase_" #_count, _count, 1)
#define BENCH_ITERATE_(_label, _count, _best)
Definition benchmark_mapmodify.cpp:38

Referenced by TEST_CASE().

◆ BENCH_ITERATE_

#define BENCH_ITERATE_ ( _label,
_count,
_best )
Value:
BENCHMARK_ADVANCED(_label)(Catch::Benchmark::Chronometer meter) { \
TestMap map; \
fill(map, _count); \
if (!_best) pollute(map); \
meter.measure([&] { \
size_t x = map.size(); \
for (auto &it : map.iter()) { \
if (!it.second) \
continue; \
x ^= reinterpret_cast<intptr_t>(it.second); \
} \
return x; \
}); \
};
static void pollute(TestMap &map)
Definition benchmark_mapmodify.cpp:20
constexpr v3f x
Definition test_irr_matrix4.cpp:18

◆ BENCH_REMOVE

#define BENCH_REMOVE ( _count)
Value:
BENCHMARK_ADVANCED("remove_" #_count)(Catch::Benchmark::Chronometer meter) { \
TestMap map; \
fill(map, _count); \
meter.measure([&] { \
for (auto it : map.iter()) { \
(void)it; \
remove(map, (_count) / 7, (_count) / 2); /* delete half */ \
break; \
} \
}); \
};

Referenced by TEST_CASE().

Typedef Documentation

◆ TestMap

using TestMap = ModifySafeMap<u16, void*>

Function Documentation

◆ fill()

void fill ( TestMap & map,
size_t n )
inlinestatic

Referenced by benchGetObjectsInArea(), and benchGetObjectsInsideRadius().

Here is the caller graph for this function:

◆ pollute()

void pollute ( TestMap & map)
inlinestatic

◆ remove()

void remove ( TestMap & map,
size_t offset,
size_t count )
inlinestatic

Referenced by ModStorageDatabaseSQLite3::~ModStorageDatabaseSQLite3(), EventManager::dereg(), ScriptApiSecurity::initializeSecurity(), ModStorageDatabaseSQLite3::initStatements(), GUIModalMenu::quitMenu(), and fs::safeWriteToFile().

Here is the caller graph for this function:

◆ TEST_CASE()

TEST_CASE ( "ModifySafeMap" )

References BENCH_ITERATE, and BENCH_REMOVE.