MCPcopy Create free account
hub / github.com/CrowdStrike/csproto / BenchmarkEncodeString

Function BenchmarkEncodeString

benchmarks_test.go:9–18  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

7)
8
9func BenchmarkEncodeString(b *testing.B) {
10 var (
11 s = "this is a reasonably long string so that the encoder function has to actually do some work"
12 buf = make([]byte, len(s))
13 )
14 for n := 0; n < b.N; n++ {
15 enc := csproto.NewEncoder(buf)
16 enc.EncodeString(1, s)
17 }
18}
19
20func BenchmarkSafeDecodeString(b *testing.B) {
21 var (

Callers

nothing calls this directly

Calls 2

EncodeStringMethod · 0.95
NewEncoderFunction · 0.92

Tested by

no test coverage detected