7 "github.com/golang/protobuf/proto"
8 ppb "github.com/golang/protobuf/proto/proto3_proto"
11 func marshalled() []byte {
13 for i := 0; i < 1000; i++ {
14 m.Maps = append(m.Maps, &ppb.IntMap{
15 Rtt: map[int32]int32{1: 2},
18 b, err := proto.Marshal(m)
20 panic(fmt.Sprintf("Can't marshal %+v: %v", m, err))
25 func BenchmarkConcurrentMapUnmarshal(b *testing.B) {
27 b.RunParallel(func(pb *testing.PB) {
30 if err := proto.Unmarshal(in, &out); err != nil {
31 b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)
37 func BenchmarkSequentialMapUnmarshal(b *testing.B) {
40 for i := 0; i < b.N; i++ {
42 if err := proto.Unmarshal(in, &out); err != nil {
43 b.Errorf("Can't unmarshal ppb.IntMaps: %v", err)