Slight memory usage reduction

This commit is contained in:
2026-07-01 10:12:07 +01:00
parent 34f14e8dc0
commit c185289c74
4 changed files with 41 additions and 30 deletions
+18 -9
View File
@@ -15,6 +15,7 @@ To start replaying:
`BeamNGMockOg replay [--loop] -a 127.0.0.1 -p 4443 -i sunburstManual.bin`
- `loop` allows the replay functionality to keep replaying the same data file
To start recording:
`BeamNGMockOg record -a 127.0.0.1 -p 4443 -o sunburstDCT.bin`
@@ -22,6 +23,7 @@ To start recording:
Use `tcpdump` to listen to the socket and check if data is coming through:
`tcpdump -i any udp port <port> -X`
### Benchmark
Run with:
`go test ./mockserver -bench=BenchmarkReplayAsync -benchmem -benchtime=1x -memprofile=mem.pprof`
@@ -33,16 +35,10 @@ Analyze the output with:
or
`go tool pprof -http=:8080 mem.pprof`
#### Previous results:
goos: linux
goarch: amd64
pkg: github.com/ESilva15/BeamNGMockOg/mockserver
cpu: AMD Ryzen 5 5600G with Radeon Graphics
BenchmarkReplayAsync-12 1 109433574741 ns/op 4533008 B/op 66059 allocs/op
PASS
ok github.com/ESilva15/BeamNGMockOg/mockserver 109.438s
#### Current results
#### Previous results:
Note: this were made before introducing the real time visualizer
```
goos: linux
goarch: amd64
pkg: github.com/ESilva15/BeamNGMockOg/mockserver
@@ -50,3 +46,16 @@ cpu: AMD Ryzen 5 5600G with Radeon Graphics
BenchmarkReplayAsync-12 1 109433931841 ns/op 356088 B/op 13272 allocs/op
PASS
ok github.com/ESilva15/BeamNGMockOg/mockserver 109.440s
```
#### Current results
```
goos: linux
goarch: amd64
pkg: github.com/ESilva15/BeamNGMockOg/mockserver
cpu: AMD Ryzen 7 5800X3D 8-Core Processor
BenchmarkReplayAsync-16 1 109433890158 ns/op 1673128 B/op 112986 allocs/op
PASS
ok github.com/ESilva15/BeamNGMockOg/mockserver 109.439s
```