mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-01-15 02:40:07 +08:00
184 lines
4.8 KiB
Go
184 lines
4.8 KiB
Go
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
// source: pstore.proto
|
|
|
|
package pstore_pb
|
|
|
|
import (
|
|
fmt "fmt"
|
|
_ "github.com/gogo/protobuf/gogoproto"
|
|
github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
|
proto "github.com/gogo/protobuf/proto"
|
|
math "math"
|
|
math_rand "math/rand"
|
|
testing "testing"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
func BenchmarkAddrBookRecordProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AddrBookRecord, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedAddrBookRecord(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAddrBookRecordProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAddrBookRecord(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &AddrBookRecord{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAddrBookRecord_AddrEntryProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AddrBookRecord_AddrEntry, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedAddrBookRecord_AddrEntry(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAddrBookRecord_AddrEntryProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAddrBookRecord_AddrEntry(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &AddrBookRecord_AddrEntry{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAddrBookRecord_CertifiedRecordProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AddrBookRecord_CertifiedRecord, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedAddrBookRecord_CertifiedRecord(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAddrBookRecord_CertifiedRecordProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAddrBookRecord_CertifiedRecord(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &AddrBookRecord_CertifiedRecord{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAddrBookRecordSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AddrBookRecord, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedAddrBookRecord(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAddrBookRecord_AddrEntrySize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AddrBookRecord_AddrEntry, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedAddrBookRecord_AddrEntry(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAddrBookRecord_CertifiedRecordSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AddrBookRecord_CertifiedRecord, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedAddrBookRecord_CertifiedRecord(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
//These tests are generated by github.com/gogo/protobuf/plugin/testgen
|