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

Function BenchmarkParseIntUnsafeSlower

bytes_test.go:135–140  ·  view source on GitHub ↗

Alternative implementation using unsafe and delegating to strconv.ParseInt Verifies: SYS-REQ-015 [example] MCDC SYS-REQ-015: N/A

(b *testing.B)

Source from the content-addressed store, hash-verified

133// Verifies: SYS-REQ-015 [example]
134// MCDC SYS-REQ-015: N/A
135func BenchmarkParseIntUnsafeSlower(b *testing.B) {
136 bytes := []byte("123")
137 for i := 0; i < b.N; i++ {
138 strconv.ParseInt(*(*string)(unsafe.Pointer(&bytes)), 10, 64)
139 }
140}
141
142// Old implementation that did not check for overflows.
143// Verifies: SYS-REQ-015 [example]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected