MCPcopy
hub / github.com/grpc/grpc-go / fastMarshalAndUnmarshal

Function fastMarshalAndUnmarshal

encoding/proto/proto_benchmark_test.go:90–99  ·  view source on GitHub ↗
(codec encoding.CodecV2, protoStruct proto.Message, b *testing.B)

Source from the content-addressed store, hash-verified

88}
89
90func fastMarshalAndUnmarshal(codec encoding.CodecV2, protoStruct proto.Message, b *testing.B) {
91 marshaledBytes, err := codec.Marshal(protoStruct)
92 if err != nil {
93 b.Errorf("codec.Marshal(_) returned an error")
94 }
95 res := pb.Buffer{}
96 if err := codec.Unmarshal(marshaledBytes, &res); err != nil {
97 b.Errorf("codec.Unmarshal(_) returned an error")
98 }
99}

Callers 1

benchmarkProtoCodecFunction · 0.85

Calls 3

MarshalMethod · 0.65
ErrorfMethod · 0.65
UnmarshalMethod · 0.65

Tested by

no test coverage detected