From 2fdf9d27b2f960318cb0f2913d6c2583090ef61d Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Wed, 2 Dec 2026 07:04:32 +0100 Subject: [PATCH] perf(vehicle): no AI stopwatch in test mode updateDriver() timed each driver's update for the debug panel (Timer::subsystem.vehicles_ai), which reads the clock twice per vehicle with a driver, every physics step. The test mode has no panel to show it on; there the update runs untimed. The clock reads were 0.8% of the main thread on Tomaszewo. Outside the test mode nothing changes. --- vehicle/dynamic/update.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vehicle/dynamic/update.cpp b/vehicle/dynamic/update.cpp index b85d1cb20..3b29793d4 100644 --- a/vehicle/dynamic/update.cpp +++ b/vehicle/dynamic/update.cpp @@ -323,6 +323,12 @@ void TDynamicObject::updateDriver( double const dt1 ) distributeInductionBraking( dt1 ); } + // the time the AI takes is for the debug panel of the renderer. the test mode shows none, and the clock read twice for each + // vehicle with a driver, every step, is a part of its frame worth saving + if( Global.test.enabled ) { + Mechanik->Update(dt1); // przebłyski świadomości AI + return; + } Timer::subsystem.vehicles_ai.start(); Mechanik->Update(dt1); // przebłyski świadomości AI Timer::subsystem.vehicles_ai.stop();