MCPcopy
hub / github.com/lonng/nano / BenchmarkDecoder_Decode

Function BenchmarkDecoder_Decode

internal/codec/codec_test.go:77–95  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

75}
76
77func BenchmarkDecoder_Decode(b *testing.B) {
78 data := []byte("hello world")
79 pp1, err := Encode(Handshake, data)
80 if err != nil {
81 b.Error(err.Error())
82 }
83
84 b.ReportAllocs()
85 d1 := NewDecoder()
86 for i := 0; i < b.N; i++ {
87 packets, err := d1.Decode(pp1)
88 if err != nil {
89 b.Fatal(err)
90 }
91 if len(packets) != 1 {
92 b.Fatal("decode error")
93 }
94 }
95}

Callers

nothing calls this directly

Calls 4

DecodeMethod · 0.95
NewDecoderFunction · 0.85
FatalMethod · 0.80
EncodeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…