From 7a0b15c20ea2b233659a7a17c75b427db1fa7574 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Fri, 16 Aug 2024 22:04:00 -0700 Subject: [PATCH] Skip some clock reads when diagnostics are disabled (#628) --- src/optimization/solver/InteriorPoint.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/optimization/solver/InteriorPoint.cpp b/src/optimization/solver/InteriorPoint.cpp index 817e3d1d..dcd8b56d 100644 --- a/src/optimization/solver/InteriorPoint.cpp +++ b/src/optimization/solver/InteriorPoint.cpp @@ -240,11 +240,16 @@ void InteriorPoint(std::span decisionVariables, // Error estimate double E_0 = std::numeric_limits::infinity(); - iterationsStartTime = std::chrono::system_clock::now(); + if (config.diagnostics) { + iterationsStartTime = std::chrono::system_clock::now(); + } while (E_0 > config.tolerance && acceptableIterCounter < config.maxAcceptableIterations) { - auto innerIterStartTime = std::chrono::system_clock::now(); + std::chrono::system_clock::time_point innerIterStartTime; + if (config.diagnostics) { + innerIterStartTime = std::chrono::system_clock::now(); + } // Check for local equality constraint infeasibility if (IsEqualityLocallyInfeasible(A_e, c_e)) {