MCPcopy Create free account
hub / github.com/godbus/dbus / BenchmarkEncodeSliceInterface

Function BenchmarkEncodeSliceInterface

encoder_test.go:174–197  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

172}
173
174func BenchmarkEncodeSliceInterface(b *testing.B) {
175 val := []any{"foo", "bar"}
176 sig := SignatureOf(val)
177 buf := &bytes.Buffer{}
178 fds := make([]int, 0)
179
180 b.ReportAllocs()
181 b.ResetTimer()
182 for n := 0; n < b.N; n++ {
183 buf.Reset()
184
185 enc := newEncoder(buf, binary.LittleEndian, fds)
186 err := enc.Encode(val)
187 if err != nil {
188 b.Fatal(err)
189 }
190
191 dec := newDecoder(buf, binary.LittleEndian, enc.fds)
192 _, err = dec.Decode(sig)
193 if err != nil {
194 b.Fatal(err)
195 }
196 }
197}
198
199func TestEncodeSliceNamedInterface(t *testing.T) {
200 val := []empty{"foo", "bar"}

Callers

nothing calls this directly

Calls 6

SignatureOfFunction · 0.85
newEncoderFunction · 0.85
newDecoderFunction · 0.85
ResetMethod · 0.80
EncodeMethod · 0.80
DecodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…