MCPcopy
hub / github.com/protocolbuffers/protobuf-go / BenchmarkString

Function BenchmarkString

internal/encoding/json/bench_test.go:41–51  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

39}
40
41func BenchmarkString(b *testing.B) {
42 input := []byte(`"abcdefghijklmnopqrstuvwxyz0123456789\\n\\t"`)
43 for i := 0; i < b.N; i++ {
44 dec := json.NewDecoder(input)
45 val, err := dec.Read()
46 if err != nil {
47 b.Fatal(err)
48 }
49 _ = val.ParsedString()
50 }
51}
52
53func BenchmarkBool(b *testing.B) {
54 input := []byte(`true`)

Callers

nothing calls this directly

Calls 3

ReadMethod · 0.95
NewDecoderFunction · 0.92
ParsedStringMethod · 0.80

Tested by

no test coverage detected