MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / BenchmarkRedactErrorf

Function BenchmarkRedactErrorf

base/redactable_error_test.go:49–67  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

47}
48
49func BenchmarkRedactErrorf(b *testing.B) {
50 fmt := "Couldn't get user %q: "
51 fmtVerbs := []string{"%s", "%w"}
52 args := []interface{}{UD("Bob"), ErrNotFound}
53
54 for _, verb := range fmtVerbs {
55 err := RedactErrorf(fmt+verb, args...)
56 b.Run(verb+" String()", func(b *testing.B) {
57 for i := 0; i < b.N; i++ {
58 _ = err.String()
59 }
60 })
61 b.Run(verb+" Redact()", func(b *testing.B) {
62 for i := 0; i < b.N; i++ {
63 _ = err.Redact()
64 }
65 })
66 }
67}

Callers

nothing calls this directly

Calls 5

RedactErrorfFunction · 0.85
UDFunction · 0.70
RunMethod · 0.65
StringMethod · 0.65
RedactMethod · 0.65

Tested by

no test coverage detected