MCPcopy Create free account
hub / github.com/sergi/go-diff / BenchmarkDiffMain

Function BenchmarkDiffMain

diffmatchpatch/diff_test.go:1514–1532  ·  view source on GitHub ↗
(bench *testing.B)

Source from the content-addressed store, hash-verified

1512}
1513
1514func 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
1534func BenchmarkDiffMainLarge(b *testing.B) {
1535 s1, s2 := speedtestTexts()

Callers

nothing calls this directly

Calls 2

NewFunction · 0.85
DiffMainMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…