BenchmarkRedactCall_PlainMarkers calls .Redact() on a string with only regular ‹...› markers (no hash markers). This is the baseline.
(b *testing.B)
| 28 | // BenchmarkRedactCall_PlainMarkers calls .Redact() on a string with only |
| 29 | // regular ‹...› markers (no hash markers). This is the baseline. |
| 30 | func BenchmarkRedactCall_RegularRedaction(b *testing.B) { |
| 31 | s := Sprintf("user=%s action=%s", "alice", Safe("login")) |
| 32 | b.ResetTimer() |
| 33 | for i := 0; i < b.N; i++ { |
| 34 | _ = s.Redact() |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // BenchmarkRedactCall_HashMarkers calls .Redact() on a string with ‹†...› |
| 39 | // hash markers and hashing enabled. This exercises the SHA-256 path. |