goprotobuf: Performance improvements to text marshaling.
R=r
CC=golang-dev
http://codereview.appspot.com/6822091
diff --git a/proto/text_test.go b/proto/text_test.go
index 7445f0f..97a7c70 100644
--- a/proto/text_test.go
+++ b/proto/text_test.go
@@ -148,6 +148,15 @@
}
}
+func BenchmarkMarshalTextFull(b *testing.B) {
+ buf := new(bytes.Buffer)
+ m := newTestMessage()
+ for i := 0; i < b.N; i++ {
+ buf.Reset()
+ proto.MarshalText(buf, m)
+ }
+}
+
func compact(src string) string {
// s/[ \n]+/ /g; s/ $//;
dst := make([]byte, len(src))