Skip to content

Commit 605c469

Browse files
authored
Merge pull request moby#5356 from jsternberg/vtproto
protobuf: add vtproto as a supplemental marshaler
2 parents c1dacbc + 41a0a0c commit 605c469

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+54244
-152
lines changed

api/services/control/control_bench_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
digest "github.com/opencontainers/go-digest"
88
"github.com/stretchr/testify/require"
9-
"google.golang.org/protobuf/proto"
9+
proto "google.golang.org/protobuf/proto"
1010
"google.golang.org/protobuf/types/known/timestamppb"
1111
)
1212

@@ -17,7 +17,7 @@ func BenchmarkMarshalVertex(b *testing.B) {
1717
v := sampleVertex()
1818
for i := 0; i < b.N; i++ {
1919
var err error
20-
Buf, err = proto.Marshal(v)
20+
Buf, err = v.MarshalVT()
2121
require.NoError(b, err)
2222
}
2323
}
@@ -26,7 +26,7 @@ func BenchmarkMarshalVertexStatus(b *testing.B) {
2626
v := sampleVertexStatus()
2727
for i := 0; i < b.N; i++ {
2828
var err error
29-
Buf, err = proto.Marshal(v)
29+
Buf, err = v.MarshalVT()
3030
require.NoError(b, err)
3131
}
3232
}
@@ -35,7 +35,7 @@ func BenchmarkMarshalVertexLog(b *testing.B) {
3535
v := sampleVertexLog()
3636
for i := 0; i < b.N; i++ {
3737
var err error
38-
Buf, err = proto.Marshal(v)
38+
Buf, err = v.MarshalVT()
3939
require.NoError(b, err)
4040
}
4141
}
@@ -48,7 +48,7 @@ func BenchmarkUnmarshalVertex(b *testing.B) {
4848
require.NoError(b, err)
4949

5050
for i := 0; i < b.N; i++ {
51-
err := proto.Unmarshal(buf, &VertexOutput)
51+
err := VertexOutput.UnmarshalVT(buf)
5252
require.NoError(b, err)
5353
}
5454
}
@@ -61,7 +61,7 @@ func BenchmarkUnmarshalVertexStatus(b *testing.B) {
6161
require.NoError(b, err)
6262

6363
for i := 0; i < b.N; i++ {
64-
err := proto.Unmarshal(buf, &VertexStatusOutput)
64+
err := VertexStatusOutput.UnmarshalVT(buf)
6565
require.NoError(b, err)
6666
}
6767
}
@@ -74,7 +74,7 @@ func BenchmarkUnmarshalVertexLog(b *testing.B) {
7474
require.NoError(b, err)
7575

7676
for i := 0; i < b.N; i++ {
77-
err := proto.Unmarshal(buf, &VertexLogOutput)
77+
err := VertexLogOutput.UnmarshalVT(buf)
7878
require.NoError(b, err)
7979
}
8080
}

0 commit comments

Comments
 (0)