Skip to content

Commit

Permalink
Add Decoder benchmark.
Browse files Browse the repository at this point in the history
  • Loading branch information
bemasher committed Aug 10, 2016
1 parent e7e0e2d commit afde396
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions decode/decode_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package decode

import "testing"

func NewPacketConfig(chipLength int) (cfg PacketConfig) {
cfg.CenterFreq = 912600155
cfg.DataRate = 32768
cfg.ChipLength = chipLength
cfg.PreambleSymbols = 21
cfg.PacketSymbols = 96

cfg.Preamble = "111110010101001100000"

return
}

func BenchmarkDecode(b *testing.B) {
d := NewDecoder(NewPacketConfig(72), 1)

block := make([]byte, d.DecCfg.BlockSize2)

b.SetBytes(int64(d.DecCfg.BlockSize))
b.ReportAllocs()
b.ResetTimer()
for n := 0; n < b.N; n++ {
_ = d.Decode(block)
}
}

0 comments on commit afde396

Please sign in to comment.