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

Function BenchmarkPatchApply

diffmatchpatch/patch_test.go:407–420  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

405}
406
407func BenchmarkPatchApply(b *testing.B) {
408 s1, s2 := speedtestTexts()
409
410 dmp := New()
411 patches := dmp.PatchMake(s1, s2)
412 // Shift the text so patches miss their expected location and fall back to fuzzy matching.
413 text := strings.Repeat("x", 16) + s1
414
415 b.ResetTimer()
416
417 for i := 0; i < b.N; i++ {
418 dmp.PatchApply(patches, text)
419 }
420}
421
422func BenchmarkPatchSplitMax(b *testing.B) {
423 s1, _ := speedtestTexts()

Callers

nothing calls this directly

Calls 4

speedtestTextsFunction · 0.85
NewFunction · 0.85
PatchMakeMethod · 0.80
PatchApplyMethod · 0.80

Tested by

no test coverage detected