blob: eba411905fd9b94f06f3c7c809c85477b8fde751 [file] [log] [blame]
Herbie Ong17523eb2019-03-29 17:46:57 -07001// 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
5package jsonpb_test
6
7import (
8 "testing"
9
10 "github.com/golang/protobuf/v2/encoding/jsonpb"
11 knownpb "github.com/golang/protobuf/v2/types/known"
12)
13
14func 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}