pascalkuthe / imara-diff

Reliably performant diffing
Apache License 2.0
106 stars 9 forks source link

Add convenience feature for word diff #1

Open pascalkuthe opened 1 year ago

pascalkuthe commented 1 year ago

Performing a word diff over a full file can be fairly slow on large files. A better approach is to perform a line diff first and and then perform the word diff on the found changes. While this is already possible with imara-diff is requires quite a bit of legwork and can be tricky to get right. It would be nice if this could be included in the library directly. This has multiple steps for an implementation:

The diff algorithm in git only operates on lines. It is worth looking into what exactly they use to produce a colored word diff from the line diff. Perhaps a different algorithm is a better fit?

jlama commented 1 year ago

FYI git does word diffing by feeding the same algorithm with one word per line.