| 49 | } |
| 50 | |
| 51 | func BenchmarkDetectXSS_MISS(b *testing.B) { |
| 52 | var result = injectionutils.DetectXSS("<html><body><span>RequestId: 1234567890</span></body></html>", false) |
| 53 | if result { |
| 54 | b.Fatal("'result' should not be 'true'") |
| 55 | } |
| 56 | |
| 57 | runtime.GOMAXPROCS(4) |
| 58 | |
| 59 | b.RunParallel(func(pb *testing.PB) { |
| 60 | for pb.Next() { |
| 61 | _ = injectionutils.DetectXSS("<html><body><span>RequestId: 1234567890</span></body></html>", false) |
| 62 | } |
| 63 | }) |
| 64 | } |
| 65 | |
| 66 | func BenchmarkDetectXSS_MISS_Cache(b *testing.B) { |
| 67 | var result = injectionutils.DetectXSS("<html><body><span>RequestId: 1234567890</span></body></html>", false) |