Skip to content

Commit

Permalink
myers: specify which myers' diff algorithm we're using
Browse files Browse the repository at this point in the history
i believe this may explain the significant performance gap
between this module and git's implementation.

good thing i'm doing all this digging while the api still has some flexibility.
eek. :)

updates #18, insofar as it means that i want to do some more implementing
before declaring this part of the api stable.
  • Loading branch information
josharian committed Jan 1, 2020
1 parent 3b17ca0 commit 0f84953
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions myers/myers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ type Pair interface {
}

// Diff calculates an edit.Script for ab using the Myers diff algorithm.
// This implementation uses the algorithm described in the first half
// of Myers' paper, which requires quadratric space.
// (An implementation of the linear space version is forthcoming.)
//
// Because diff calculation can be expensive, Myers supports cancellation via ctx.
func Diff(ctx context.Context, ab Pair) edit.Script {
aLen := ab.LenA()
Expand Down

0 comments on commit 0f84953

Please sign in to comment.