MCPcopy Create free account
hub / github.com/buger/jsonparser / BenchmarkStringEnd_NoEscape_Short

Function BenchmarkStringEnd_NoEscape_Short

optimization_bench_test.go:21–28  ·  view source on GitHub ↗

============================================================================= Micro-benchmarks for the fast-path optimizations modeled on PR #285. Each benchmark measures one of the optimized hot paths on inputs that exercise (a) the common-case fast path and (b) the rare-case slow path, so the bef

(b *testing.B)

Source from the content-addressed store, hash-verified

19// bytes.IndexByte (SIMD on amd64/arm64) to skip the per-byte scan.
20
21func BenchmarkStringEnd_NoEscape_Short(b *testing.B) {
22 data := []byte(`hello world"`)
23 b.SetBytes(int64(len(data)))
24 b.ResetTimer()
25 for i := 0; i < b.N; i++ {
26 _, _ = stringEnd(data)
27 }
28}
29
30func BenchmarkStringEnd_NoEscape_Long(b *testing.B) {
31 // 128-byte string value, no escapes — exercises the SIMD fast path.

Callers

nothing calls this directly

Calls 1

stringEndFunction · 0.85

Tested by

no test coverage detected