Herbie Ong | 17523eb | 2019-03-29 17:46:57 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package jsonpb_test |
| 6 | |
| 7 | import ( |
| 8 | "testing" |
| 9 | |
| 10 | "github.com/golang/protobuf/v2/encoding/jsonpb" |
| 11 | knownpb "github.com/golang/protobuf/v2/types/known" |
| 12 | ) |
| 13 | |
| 14 | func BenchmarkUnmarshal_Duration(b *testing.B) { |
| 15 | input := []byte(`"-123456789.123456789s"`) |
| 16 | |
| 17 | for i := 0; i < b.N; i++ { |
| 18 | err := jsonpb.Unmarshal(&knownpb.Duration{}, input) |
| 19 | if err != nil { |
| 20 | b.Fatal(err) |
| 21 | } |
| 22 | } |
| 23 | } |