| 1512 | } |
| 1513 | |
| 1514 | func BenchmarkDiffMain(bench *testing.B) { |
| 1515 | s1 := "`Twas brillig, and the slithy toves\nDid gyre and gimble in the wabe:\nAll mimsy were the borogoves,\nAnd the mome raths outgrabe.\n" |
| 1516 | s2 := "I am the very model of a modern major general,\nI've information vegetable, animal, and mineral,\nI know the kings of England, and I quote the fights historical,\nFrom Marathon to Waterloo, in order categorical.\n" |
| 1517 | |
| 1518 | // Increase the text lengths by 1024 times to ensure a timeout. |
| 1519 | for x := 0; x < 10; x++ { |
| 1520 | s1 = s1 + s1 |
| 1521 | s2 = s2 + s2 |
| 1522 | } |
| 1523 | |
| 1524 | dmp := New() |
| 1525 | dmp.DiffTimeout = time.Second |
| 1526 | |
| 1527 | bench.ResetTimer() |
| 1528 | |
| 1529 | for i := 0; i < bench.N; i++ { |
| 1530 | dmp.DiffMain(s1, s2, true) |
| 1531 | } |
| 1532 | } |
| 1533 | |
| 1534 | func BenchmarkDiffMainLarge(b *testing.B) { |
| 1535 | s1, s2 := speedtestTexts() |