mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-05-15 05:54:17 +00:00
add basic benchmark for most processors
This commit is contained in:
@@ -101,3 +101,26 @@ func TestBadArtnetPacketEncode(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkArtnetPacketEncode(b *testing.B) {
|
||||
processorInstance := processor.ArtNetPacketEncode{}
|
||||
payload := &artnet.ArtDmx{
|
||||
ID: []byte{'A', 'r', 't', '-', 'N', 'e', 't', 0x00},
|
||||
OpCode: artnet.OpDmx,
|
||||
ProtVerHi: 0,
|
||||
ProtVerLo: 14,
|
||||
Sequence: 237,
|
||||
Physical: 0,
|
||||
SubUni: 1,
|
||||
Net: 0,
|
||||
Length: 512,
|
||||
Data: make([]uint8, 512),
|
||||
}
|
||||
|
||||
for b.Loop() {
|
||||
_, err := processorInstance.Process(b.Context(), common.WrappedPayload{Payload: payload})
|
||||
if err != nil {
|
||||
b.Fatalf("artnet.packet.encode processing failed: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user