From 197f8b6e5ce939f83e2b103a742ae37be5879d05 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Sat, 13 Jun 2026 15:17:25 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20Commit=E6=89=B9=E9=87=8F50=E5=B8=A7=20+?= =?UTF-8?q?=20Calc=E5=9B=9E=E5=88=B0+1(11=E5=8F=91=E6=9C=80=E4=BC=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _frameDb.Commit() 从每帧改为每50帧批量提交 - CalcRoundsNeeded 回退到 +1(12发反更差) - Piston: 10机50m间距8/10击毁 --- src/CounterDrone.Core/Simulation/SimulationEngine.cs | 2 +- test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CounterDrone.Core/Simulation/SimulationEngine.cs b/src/CounterDrone.Core/Simulation/SimulationEngine.cs index 702b5e8..0933187 100644 --- a/src/CounterDrone.Core/Simulation/SimulationEngine.cs +++ b/src/CounterDrone.Core/Simulation/SimulationEngine.cs @@ -281,7 +281,7 @@ namespace CounterDrone.Core.Simulation var snapshots = CollectSnapshots(); _frameStore.WriteFrame(_frameDb, _taskId, FrameIndex, SimulationTime, snapshots); - _frameDb.Commit(); + if (FrameIndex % 50 == 0) _frameDb.Commit(); return new SimulationFrameResult { EntitySnapshots = snapshots, NewEvents = frameEvents, State = State, FrameIndex = FrameIndex, SimulationTime = SimulationTime }; } diff --git a/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs b/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs index f3a0e61..8895b02 100644 --- a/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs +++ b/test/unit/CounterDrone.Core.Tests/FullPipelineTests.cs @@ -202,14 +202,14 @@ namespace CounterDrone.Core.Tests { GroupId = "default", TargetType = (int)TargetType.Piston, PowerType = (int)PowerType.Piston, - Quantity = 3, // 单批次 3 架 + Quantity = 10, // 10 架 TypicalSpeed = 200, TypicalAltitude = 500, }); _scenario.SaveRoute(_taskId, "default", new RoutePlan { FormationMode = (int)FormationMode.Formation, - LateralSpacing = 200, - LateralCount = 3, + LateralSpacing = 50, + LateralCount = 10, LongitudinalCount = 1, }, new List @@ -219,7 +219,7 @@ namespace CounterDrone.Core.Tests }); _scenario.SaveDeployment(_taskId, new List { - MakeEquipment(DefaultFireUnits.GetById("ground-light"), AerosolType.InertGas, 8, 5000, 0, 50), + MakeEquipment(DefaultFireUnits.GetById("ground-light"), AerosolType.InertGas, 10, 5000, 0, 50), }); _scenario.SaveCloudDispersal(_taskId, new CloudDispersal { AerosolType = (int)AerosolType.InertGas, DisperseHeight = 500 });