| 1540 | } |
| 1541 | |
| 1542 | func BenchmarkDiffMain(bench *testing.B) { |
| 1543 | 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" |
| 1544 | 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" |
| 1545 | |
| 1546 | // Increase the text lengths by 1024 times to ensure a timeout. |
| 1547 | for x := 0; x < 10; x++ { |
| 1548 | s1 = s1 + s1 |
| 1549 | s2 = s2 + s2 |
| 1550 | } |
| 1551 | |
| 1552 | dmp := New() |
| 1553 | dmp.DiffTimeout = time.Second |
| 1554 | |
| 1555 | bench.ResetTimer() |
| 1556 | |
| 1557 | for i := 0; i < bench.N; i++ { |
| 1558 | dmp.DiffMain(s1, s2, true) |
| 1559 | } |
| 1560 | } |
| 1561 | |
| 1562 | func BenchmarkDiffMainLarge(b *testing.B) { |
| 1563 | s1, s2 := speedtestTexts() |