Skip to content
This repository was archived by the owner on Sep 7, 2023. It is now read-only.

Commit cfd8d59

Browse files
committed
perf: optimize performance
1 parent 80ae25e commit cfd8d59

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
dotnet-version: 6.0.x
2424

2525
- name: Build the program
26-
run: dotnet publish -o Build -c Release -r win10-x64 --self-contained false
26+
run: dotnet publish -o Build -c Release -r win10-x64 --self-contained false -p:DebugType=none -p:DebugSymbol=false -p:PublishSingleFile=true -p:PublishReadyToRun=true
2727

2828
- name: Copy the essential files
2929
run: |

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
None
1111

12+
## 24.4.1
13+
14+
### Changed
15+
16+
- Optimize performance
17+
1218
## 24.4.0
1319

1420
### Fixed

Source/MainWindow.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public partial class MainWindow : Form
6565
/// <summary>
6666
/// FPS = Old FPS * (1 - FpsUpdateDecay) + New FPS * FpsUpdateDecay
6767
/// </summary>
68-
private const decimal FpsUpdateDecay = 0.2M;
68+
private const decimal FpsUpdateDecay = 0.01M;
6969

7070
/// <summary>
7171
/// The size of icons shown on the monitor
@@ -168,7 +168,7 @@ public Dictionary<CampType, SerialPort> SerialPortDict
168168
private ConfigType _config = MainWindow.DefaultConfig;
169169
private OpenCvSharp.Size _courtSize;
170170
private CoordinateConverter _coordinateConverter;
171-
private decimal _fps = 0; // Just a magic number.
171+
private decimal _fps = 30; // Just a magic number.
172172
private Game _game = new Game();
173173
private Dictionary<CampType, Locator> _locatorDict = new Dictionary<CampType, Locator>();
174174
private Point2f[] _monitorCorners = new Point2f[4];
@@ -248,7 +248,7 @@ public MainWindow()
248248
);
249249

250250
// Setup the timer
251-
this.timer.Interval = Math.Min(Math.Max((int)(1000 / this._camera.Fps), 1), 1000);
251+
this.timer.Interval = 1;
252252
this.timer.Start();
253253

254254
// Setup the locators
@@ -279,12 +279,6 @@ private void RefreshAll()
279279
return;
280280
}
281281

282-
// Update the timer interval.
283-
if (this.timer.Interval != Math.Min(Math.Max((int)(1000 / this._camera.Fps), 1), 1000))
284-
{
285-
this.timer.Interval = Math.Min(Math.Max((int)(1000 / this._camera.Fps), 1), 1000);
286-
}
287-
288282
this.ProcessCameraFrame();
289283

290284
// Refresh the game.

0 commit comments

Comments
 (0)