add some basic benchmarks

This commit is contained in:
Joel Wetzell
2026-05-14 21:11:55 -05:00
parent 21beb6316e
commit 64814b9e05
2 changed files with 27 additions and 1 deletions
+26
View File
@@ -84,3 +84,29 @@ func TestMessageEncoding(t *testing.T) {
}
}
}
func BenchmarkMessageDecoding(b *testing.B) {
data := []byte{0xd1, 0x01, 0x5a, 0x00, 0x00, 0x2d, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x7f, 0xff, 0x40, 0x7f, 0xff, 0x80, 0x7f, 0xff,
0xc0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00, 50,
}
for b.Loop() {
Decode(data)
}
}
func BenchmarkMessageEncoding(b *testing.B) {
message := FreeDPosition{
ID: 1,
Pan: 180,
Tilt: 90,
Roll: -180,
PosX: 131069,
PosY: 131070,
PosZ: 131071,
Zoom: 66051,
Focus: 263430,
}
for b.Loop() {
Encode(message)
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
module github.com/jwetzell/free-d-go
go 1.23.4
go 1.26.2