(b *testing.B)
| 293 | } |
| 294 | |
| 295 | func BenchmarkDifference(b *testing.B) { |
| 296 | for n := 1 << 10; n <= 1<<20; n <<= 2 { |
| 297 | b.Run(fmt.Sprintf("N%d", n), func(b *testing.B) { |
| 298 | x, y := generateStrings(n, 0.05, 0.05, 0.10, 0) |
| 299 | b.ReportAllocs() |
| 300 | b.SetBytes(int64(len(x) + len(y))) |
| 301 | for i := 0; i < b.N; i++ { |
| 302 | Difference(len(x), len(y), func(ix, iy int) Result { |
| 303 | return compareByte(x[ix], y[iy]) |
| 304 | }) |
| 305 | } |
| 306 | }) |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | func generateStrings(n int, px, py, pm float32, seed int64) (string, string) { |
| 311 | if px+py+pm > 1.0 { |
nothing calls this directly
no test coverage detected