Add benchmarks for serializing PodList
This commit is contained in:
@@ -25,7 +25,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -165,6 +165,39 @@ func BenchmarkEncodeProtobufGeneratedMarshal(b *testing.B) {
|
||||
b.StopTimer()
|
||||
}
|
||||
|
||||
func BenchmarkEncodeProtobufGeneratedMarshalList10(b *testing.B) {
|
||||
item := benchmarkItemsList(b, 10)
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
if _, err := item.Marshal(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
b.StopTimer()
|
||||
}
|
||||
|
||||
func BenchmarkEncodeProtobufGeneratedMarshalList100(b *testing.B) {
|
||||
item := benchmarkItemsList(b, 100)
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
if _, err := item.Marshal(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
b.StopTimer()
|
||||
}
|
||||
|
||||
func BenchmarkEncodeProtobufGeneratedMarshalList1000(b *testing.B) {
|
||||
item := benchmarkItemsList(b, 1000)
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
if _, err := item.Marshal(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
b.StopTimer()
|
||||
}
|
||||
|
||||
// BenchmarkDecodeCodecToInternalProtobuf measures the cost of performing a codec decode,
|
||||
// including conversions and any type setting. This is a "full" decode.
|
||||
func BenchmarkDecodeCodecToInternalProtobuf(b *testing.B) {
|
||||
|
Reference in New Issue
Block a user