From bd47dddb58d59bf0fbfd009a33fe9e79a62851ed Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Sat, 30 May 2026 10:54:20 -0500 Subject: [PATCH] add benchmark for all marshal functions --- command_test.go | 11 +++++++++++ datarequest_test.go | 11 +++++++++++ diagdata_test.go | 11 +++++++++++ ipprogreply_test.go | 11 +++++++++++ nzs_test.go | 11 +++++++++++ pollreply_test.go | 11 +++++++++++ sync_test.go | 11 +++++++++++ trigger_test.go | 11 +++++++++++ 8 files changed, 88 insertions(+) diff --git a/command_test.go b/command_test.go index 750eb98..71051c4 100644 --- a/command_test.go +++ b/command_test.go @@ -30,3 +30,14 @@ func TestGoodArtCommandUnmarshal(t *testing.T) { }) } } + +func BenchmarkArtCommandMarshalBinary(b *testing.B) { + data := artnet.ArtCommand{} + + for b.Loop() { + _, err := data.MarshalBinary() + if err != nil { + b.Fatalf("failed to encode ArtCommand: %s", err) + } + } +} diff --git a/datarequest_test.go b/datarequest_test.go index 9dbf75f..9c5d139 100644 --- a/datarequest_test.go +++ b/datarequest_test.go @@ -30,3 +30,14 @@ func TestGoodArtDataRequestUnmarshal(t *testing.T) { }) } } + +func BenchmarkArtDataRequestMarshalBinary(b *testing.B) { + data := artnet.ArtDataRequest{} + + for b.Loop() { + _, err := data.MarshalBinary() + if err != nil { + b.Fatalf("failed to encode ArtDataRequest: %s", err) + } + } +} diff --git a/diagdata_test.go b/diagdata_test.go index a5a845b..e706265 100644 --- a/diagdata_test.go +++ b/diagdata_test.go @@ -30,3 +30,14 @@ func TestGoodArtDiagDataUnmarshal(t *testing.T) { }) } } + +func BenchmarkArtDiagDataMarshalBinary(b *testing.B) { + data := artnet.ArtDiagData{} + + for b.Loop() { + _, err := data.MarshalBinary() + if err != nil { + b.Fatalf("failed to encode ArtDiagData: %s", err) + } + } +} diff --git a/ipprogreply_test.go b/ipprogreply_test.go index e65b21f..daa96e2 100644 --- a/ipprogreply_test.go +++ b/ipprogreply_test.go @@ -30,3 +30,14 @@ func TestGoodArtIpProgReplyUnmarshal(t *testing.T) { }) } } + +func BenchmarkArtIpProgReplyMarshalBinary(b *testing.B) { + data := artnet.ArtIpProgReply{} + + for b.Loop() { + _, err := data.MarshalBinary() + if err != nil { + b.Fatalf("failed to encode ArtIpProgReply: %s", err) + } + } +} diff --git a/nzs_test.go b/nzs_test.go index d75fa8b..488a05f 100644 --- a/nzs_test.go +++ b/nzs_test.go @@ -30,3 +30,14 @@ func TestGoodArtNzsUnmarshal(t *testing.T) { }) } } + +func BenchmarkArtNzsMarshalBinary(b *testing.B) { + data := artnet.ArtNzs{} + + for b.Loop() { + _, err := data.MarshalBinary() + if err != nil { + b.Fatalf("failed to encode ArtNzs: %s", err) + } + } +} diff --git a/pollreply_test.go b/pollreply_test.go index b282b81..a0d0bed 100644 --- a/pollreply_test.go +++ b/pollreply_test.go @@ -30,3 +30,14 @@ func TestGoodArtPollReplyUnmarshal(t *testing.T) { }) } } + +func BenchmarkArtPollReplyMarshalBinary(b *testing.B) { + data := artnet.ArtPollReply{} + + for b.Loop() { + _, err := data.MarshalBinary() + if err != nil { + b.Fatalf("failed to encode ArtPollReply: %s", err) + } + } +} diff --git a/sync_test.go b/sync_test.go index e85c5a4..379964d 100644 --- a/sync_test.go +++ b/sync_test.go @@ -30,3 +30,14 @@ func TestGoodArtSyncUnmarshal(t *testing.T) { }) } } + +func BenchmarkArtSyncMarshalBinary(b *testing.B) { + data := artnet.ArtSync{} + + for b.Loop() { + _, err := data.MarshalBinary() + if err != nil { + b.Fatalf("failed to encode ArtSync: %s", err) + } + } +} diff --git a/trigger_test.go b/trigger_test.go index 13be1e1..a0578c9 100644 --- a/trigger_test.go +++ b/trigger_test.go @@ -30,3 +30,14 @@ func TestGoodArtTriggerUnmarshal(t *testing.T) { }) } } + +func BenchmarkArtTriggerMarshalBinary(b *testing.B) { + data := artnet.ArtTrigger{} + + for b.Loop() { + _, err := data.MarshalBinary() + if err != nil { + b.Fatalf("failed to encode ArtTrigger: %s", err) + } + } +}