MCPcopy
hub / github.com/bnb-chain/bsc / BenchmarkEncodeStructPtrSlice

Function BenchmarkEncodeStructPtrSlice

rlp/encode_test.go:620–638  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

618type structPtrSlice []*structSliceElem
619
620func BenchmarkEncodeStructPtrSlice(b *testing.B) {
621 var out bytes.Buffer
622 var value = structPtrSlice{
623 &structSliceElem{1, 1, 1},
624 &structSliceElem{2, 2, 2},
625 &structSliceElem{3, 3, 3},
626 &structSliceElem{5, 5, 5},
627 &structSliceElem{6, 6, 6},
628 &structSliceElem{7, 7, 7},
629 }
630
631 b.ReportAllocs()
632 for i := 0; i < b.N; i++ {
633 out.Reset()
634 if err := Encode(&out, &value); err != nil {
635 b.Fatal(err)
636 }
637 }
638}

Callers

nothing calls this directly

Calls 3

FatalMethod · 0.80
EncodeFunction · 0.70
ResetMethod · 0.65

Tested by

no test coverage detected