MCPcopy
hub / github.com/grpc/grpc-go / BenchmarkCodeStringSwitch

Function BenchmarkCodeStringSwitch

benchmark/primitives/code_string_test.go:104–109  ·  view source on GitHub ↗

codes.Code.String() does a switch.

(b *testing.B)

Source from the content-addressed store, hash-verified

102
103// codes.Code.String() does a switch.
104func BenchmarkCodeStringSwitch(b *testing.B) {
105 for i := 0; i < b.N; i++ {
106 c := codes.Code(uint32(i % 17))
107 _ = c.String()
108 }
109}
110
111// Testing all codes (0<=c<=16) and also one overflow (17).
112func BenchmarkCodeStringStringerWithOverflow(b *testing.B) {

Callers

nothing calls this directly

Calls 2

CodeTypeAlias · 0.92
StringMethod · 0.65

Tested by

no test coverage detected