#include "refl/vertex.h" #include void TestRefl1(benchmark::State& state) { auto cls = &TypeInfo::StaticClass; vec3 v; auto ptr = (void*)&v; auto ov = cls->New(ptr); int x = 1, y = 2; for (auto _ : state) { ov.Invoke("norm", { {},ptr, x, y}); } } BENCHMARK(TestRefl1); void TestRefl2(benchmark::State& state) { auto cls = &TypeInfo::StaticClass; vec3 v; auto ptr = (void*)&v; auto ov = cls->New(ptr); int x = 1, y = 2; std::vector ArgsList; ArgsList.emplace_back(); ArgsList.emplace_back(ptr); ArgsList.emplace_back(x); ArgsList.emplace_back(y); auto field = cls->GetField(cls, "norm", true); for (auto _ : state) { field->Invoke(ArgsList); } } BENCHMARK(TestRefl2); void TestCPlusPlus(benchmark::State& state) { vec3 v; int x = 1, y = 2; for (auto _ : state) { v.norm(x, y); } } BENCHMARK(TestCPlusPlus); BENCHMARK_MAIN();