summaryrefslogtreecommitdiff
path: root/libgo/go/encoding/json/stream_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/encoding/json/stream_test.go')
-rw-r--r--libgo/go/encoding/json/stream_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/libgo/go/encoding/json/stream_test.go b/libgo/go/encoding/json/stream_test.go
index 84edeb187c2..d0b3ffbce93 100644
--- a/libgo/go/encoding/json/stream_test.go
+++ b/libgo/go/encoding/json/stream_test.go
@@ -268,11 +268,13 @@ func BenchmarkEncoderEncode(b *testing.B) {
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)
+ b.RunParallel(func(pb *testing.PB) {
+ for pb.Next() {
+ if err := NewEncoder(ioutil.Discard).Encode(v); err != nil {
+ b.Fatal(err)
+ }
}
- }
+ })
}
type tokenStreamCase struct {