added source engine benchmark

This commit is contained in:
2025-09-22 02:29:36 +03:00
parent a4dcf8dc3b
commit 2bb0c82c30
2 changed files with 24 additions and 5 deletions

View File

@@ -4,7 +4,6 @@
#include <benchmark/benchmark.h> #include <benchmark/benchmark.h>
#include <omath/omath.hpp> #include <omath/omath.hpp>
#include <chrono>
using namespace omath; using namespace omath;
@@ -17,7 +16,7 @@ void mat_float_multiplication_col_major(benchmark::State& state)
b.set(7.f); b.set(7.f);
for (auto _ : state) for ([[maybe_unused]] const auto _ : state)
std::ignore = a * b; std::ignore = a * b;
} }
void mat_float_multiplication_row_major(benchmark::State& state) void mat_float_multiplication_row_major(benchmark::State& state)
@@ -29,7 +28,7 @@ void mat_float_multiplication_row_major(benchmark::State& state)
b.set(7.f); b.set(7.f);
for (auto _ : state) for ([[maybe_unused]] const auto _ : state)
std::ignore = a * b; std::ignore = a * b;
} }
@@ -42,7 +41,7 @@ void mat_double_multiplication_row_major(benchmark::State& state)
b.set(7.f); b.set(7.f);
for (auto _ : state) for ([[maybe_unused]] const auto _ : state)
std::ignore = a * b; std::ignore = a * b;
} }
@@ -55,7 +54,7 @@ void mat_double_multiplication_col_major(benchmark::State& state)
b.set(7.f); b.set(7.f);
for (auto _ : state) for ([[maybe_unused]] const auto _ : state)
std::ignore = a * b; std::ignore = a * b;
} }

View File

@@ -1,3 +1,23 @@
// //
// Created by Vlad on 9/18/2025. // Created by Vlad on 9/18/2025.
// //
#include <benchmark/benchmark.h>
#include <omath/omath.hpp>
using namespace omath;
using namespace omath::projectile_prediction;
constexpr float simulation_time_step = 1.f / 1000.f;
constexpr float hit_distance_tolerance = 5.f;
void source_engine_projectile_prediction(benchmark::State& state)
{
constexpr Target target{.m_origin = {100, 0, 90}, .m_velocity = {0, 0, 0}, .m_is_airborne = false};
constexpr Projectile projectile = {.m_origin = {3, 2, 1}, .m_launch_speed = 5000, .m_gravity_scale = 0.4};
for ([[maybe_unused]] const auto _: state)
std::ignore = ProjPredEngineLegacy(400, simulation_time_step, 50, hit_distance_tolerance)
.maybe_calculate_aim_point(projectile, target);
}
BENCHMARK(source_engine_projectile_prediction)->Iterations(10'000);