mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-12 22:53:27 +00:00
added source engine benchmark
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
Reference in New Issue
Block a user