diff options
Diffstat (limited to 'src/pkg/encoding/json/stream_test.go')
-rw-r--r-- | src/pkg/encoding/json/stream_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pkg/encoding/json/stream_test.go b/src/pkg/encoding/json/stream_test.go index 07c9e1d39..b562e8769 100644 --- a/src/pkg/encoding/json/stream_test.go +++ b/src/pkg/encoding/json/stream_test.go @@ -191,3 +191,16 @@ func TestBlocking(t *testing.T) { w.Close() } } + +func BenchmarkEncoderEncode(b *testing.B) { + b.ReportAllocs() + type T struct { + X, Y string + } + v := &T{"foo", "bar"} + for i := 0; i < b.N; i++ { + if err := NewEncoder(ioutil.Discard).Encode(v); err != nil { + b.Fatal(err) + } + } +} |