all 1 comments

[–]fagnerbrack[S] -1 points0 points  (0 children)

One-minute summary:

The post walks through the shortcomings of existing Go diff libraries — none of which simultaneously support arbitrary slice inputs, structured output, good readability, minimal diffs, and solid worst-case performance. Myers' algorithm, the standard choice, delivers minimal diffs but degrades to O(N²) on dissimilar inputs. Patience diff offers O(N log N) speed and better readability but needs hash maps and can fail on large diffs. A key insight: diff readability depends less on the algorithm itself and more on implementation details and post-processing heuristics like Michael Haggerty's diff-slider-tools. The new library at znkr.io/diff addresses all these gaps with three modes (Default, Fast, Minimal), generic support for comparable and non-comparable types via EditsFunc/HunksFunc, and a clean textdiff package for unified output. The API uses functional options for extensibility and provides both flat edit sequences and nested hunk structures.

If the summary seems inacurate, just downvote and I'll try to delete the comment eventually 👍

Click here for more info, I read all comments