From 5240a5c28a5225c4c1ebd02eb97c902e10d65657 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 Nov 2023 18:31:59 +0100 Subject: bbb --- bench/loader.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bench/loader.cpp (limited to 'bench/loader.cpp') diff --git a/bench/loader.cpp b/bench/loader.cpp new file mode 100644 index 00000000..d4d22520 --- /dev/null +++ b/bench/loader.cpp @@ -0,0 +1,36 @@ +#include "loader/loader.hpp" +#include "serialize/json-helper.hpp" +#include "serialize/anim.hpp" +#include +#include +#include +#include + +namespace floormat { + +namespace { + +void Loader_json(benchmark::State& state) +{ + loader.destroy(); + + // warmup + { for (const auto& x : loader.anim_atlas_list()) + json_helper::from_json(Path::join(loader.ANIM_PATH, ""_s.join({x, ".json"}))); + json_helper::from_json>(Path::join(loader.VOBJ_PATH, "vobj.json")); + } + + for (auto _ : state) + for (int i = 0; i < 10; i++) + { + for (const auto& x : loader.anim_atlas_list()) + json_helper::from_json(Path::join(loader.ANIM_PATH, ""_s.join({x, ".json"}))); + json_helper::from_json>(Path::join(loader.VOBJ_PATH, "vobj.json")); + } +} + +BENCHMARK(Loader_json)->Unit(benchmark::kMillisecond)->ReportAggregatesOnly(); + +} // namespace + +} // namespace floormat -- cgit v1.2.3