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

Function BenchmarkTokenEnd_Number

optimization_bench_test.go:54–62  ·  view source on GitHub ↗

--- tokenEnd --------------------------------------------------------------- Common case: a bare scalar value (number, boolean, null) terminated by a delimiter. The fast path uses bytes.IndexAny (SIMD) to find it.

(b *testing.B)

Source from the content-addressed store, hash-verified

52// delimiter. The fast path uses bytes.IndexAny (SIMD) to find it.
53
54func BenchmarkTokenEnd_Number(b *testing.B) {
55 // Typical short number terminated by a comma.
56 data := []byte(`1234567890,`)
57 b.SetBytes(int64(len(data)))
58 b.ResetTimer()
59 for i := 0; i < b.N; i++ {
60 _ = tokenEnd(data)
61 }
62}
63
64func BenchmarkTokenEnd_LongNumber(b *testing.B) {
65 // A 64-digit number — exercises the SIMD scan.

Callers

nothing calls this directly

Calls 1

tokenEndFunction · 0.85

Tested by

no test coverage detected