mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-08 09:38:16 +00:00
5c5b531562
Rename encoding/*pb to follow the convention of prefixing package names with 'proto': google.golang.org/protobuf/encoding/protojson google.golang.org/protobuf/encoding/prototext Move protogen under a compiler/ directory, just in case we ever do add more compiler-related packages. google.golang.org/protobuf/compiler/protogen Change-Id: I31010cb5cabcea8274fffcac468477b58b56e8eb Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/177178 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
24 lines
529 B
Go
24 lines
529 B
Go
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package protojson_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
knownpb "google.golang.org/protobuf/types/known"
|
|
)
|
|
|
|
func BenchmarkUnmarshal_Duration(b *testing.B) {
|
|
input := []byte(`"-123456789.123456789s"`)
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
err := protojson.Unmarshal(&knownpb.Duration{}, input)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|