From 2e1aa7be2e2829b9f15f99bbc851cf1768026f5a Mon Sep 17 00:00:00 2001 From: core Date: Fri, 28 Nov 2025 22:42:50 -0500 Subject: [PATCH] feat: solver optimization (pro tip: do not do io in the hot path) --- crates/unified/src/client/ship/thrusters.rs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/crates/unified/src/client/ship/thrusters.rs b/crates/unified/src/client/ship/thrusters.rs index 51147169510cae07ef49318675ef97456bf93c71..6eb70bf862842eaed985ba4edbce69b2d3abbd94 100644 --- a/crates/unified/src/client/ship/thrusters.rs +++ b/crates/unified/src/client/ship/thrusters.rs @@ -211,9 +211,6 @@ fn solve_thrust( 1.0 // if it's positive, force to +1 }; - // TODO(core): remove overly verbose debug logging - trace!("thruster: {:?} {}({})", thruster_vector, thruster_torque, renormalized_thruster_torque); - // Then, push all this data for the next section to deal with. all_thrusters.push((thruster_id, thruster_vector.extend(0.0), @@ -242,9 +239,6 @@ fn solve_thrust( "Coefficients" are i_0 ... i_n, and can be precomputed, and x_0 ... x_n is the "decision variables" */ - // TODO(core): Remove overly verbose debug logging - trace!("found {} thrusters, computing coefficients", all_thrusters.len()); - if all_thrusters.len() == 0 { trace!("there are no thrusters; zeroing thrust solution"); trace!("solved thrust in {}ms", start.elapsed().as_millis()); @@ -253,15 +247,8 @@ fn solve_thrust( return; } - // TODO(core): Remove overly verbose debug logging - for thruster in &all_thrusters { - trace!("thruster on ship: {:?}", thruster); - } - let coefficients = all_thrusters.iter() .map(|u| { - // TODO(core): Remove overly verbose debug logging - trace!("{} dot {}, {} dot {}", target_unit_vector, u.1.normalize(), target_torque_vector, u.2.normalize()); // Computes both system coefficients, for simplicity ( target_unit_vector.dot(u.1.normalize()), // Thrust coefficient @@ -269,9 +256,6 @@ fn solve_thrust( ) }) .map(|u| { - // TODO(core): Remove overly verbose debug logging - trace!("=> {}, {}", u.0, u.1); - // improve reliability: // if thrust coefficient is <0.1, zap it entirely (this thruster is not helping) // This is done elsewhere for torque, so pass it (u.1) through unchanged @@ -380,9 +364,6 @@ fn solve_thrust( }; for thruster in all_thrusters.iter().enumerate() { - // TODO(core): Remove overly verbose debug logging - trace!("thrust solution: thruster #{} ({:?}): {} @ coeff {}", thruster.0, thruster.1.0, thrust_solution.value(variables[thruster.0].0.1), coefficients[thruster.0].0); - trace!("torque solution: thruster #{} ({:?}): {} @ coeff {}", thruster.0, thruster.1.0, torque_solution.value(variables[thruster.0].1.1), coefficients[thruster.0].1); // TODO(core): make this more easily adjustable // Currently, we only turn on a thruster if it's variable value (think weight in a weighted sum)