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)
}