12345678910111213141516171819202122232425262728293031323334353637 |
- package jsonpb
- import (
- "testing"
- "github.com/golang/protobuf/proto"
- )
- var message proto.Message
- func BenchmarkMarshalWithPool(b *testing.B) {
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- Marshal(message)
- }
- }
- func BenchmarkMarshalBytesWithPool(b *testing.B) {
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- Marshal(message)
- }
- }
- func BenchmarkMarshalToPBString(b *testing.B) {
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- marshalToPBString(message)
- }
- }
- func marshalToPBString(pb proto.Message) (string, error) {
- return marshaller.MarshalToString(pb)
- }
|