MCPcopy
hub / github.com/tinylib/msgp / benchappendString

Function benchappendString

msgp/write_bytes_test.go:367–376  ·  view source on GitHub ↗
(size uint32, b *testing.B)

Source from the content-addressed store, hash-verified

365}
366
367func benchappendString(size uint32, b *testing.B) {
368 str := string(RandBytes(int(size)))
369 buf := make([]byte, 0, len(str)+5)
370 b.SetBytes(int64(len(str) + 5))
371 b.ReportAllocs()
372 b.ResetTimer()
373 for i := 0; i < b.N; i++ {
374 AppendString(buf[0:0], str)
375 }
376}
377
378func BenchmarkAppend16String(b *testing.B) { benchappendString(16, b) }
379

Callers 3

BenchmarkAppend16StringFunction · 0.85
BenchmarkAppend256StringFunction · 0.85

Calls 2

RandBytesFunction · 0.85
AppendStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…