Skip to content

diff: use ses for Myers sequence comparison - #418

Open
shadowmkj wants to merge 3 commits into
uutils:mainfrom
shadowmkj:feat/myers-ses-implementation
Open

shadowmkj wants to merge 3 commits into
uutils:mainfrom
shadowmkj:feat/myers-ses-implementation

Conversation

@shadowmkj

@shadowmkj shadowmkj commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR to evaluate ses (Shortest Edit Script) for sequence comparison using Eugene Myers' diff algorithm, and to compare CodSpeed
performance and hunk compatibility against main and #415 (similar).

ses is the minimal crate implementation of Myers' diff algorithm. https://github.com/shadowmkj/ses

Unlike similar, ses produces hunks that are 1:1 compatible with GNU diff's alignments and tie-breaking .

What changed:

  • Replaced the diff crate dependency with ses across normal_diff, unified_diff, context_diff,
    ed_diff, and side_diff.
  • Added edge-case tests in tests/by-util/test_diff.rs verifying 1:1 GNU diff compatibility
    (symmetrical/asymmetrical ties, replacements, and boundary changes).

- Replace the external `diff` crate dependency with the `ses` crate across all diff modules
- Update pattern matching in context, ed, normal, side, and unified diff implementations to use `ses::Change` variants (`Delete`, `Insert`, `Equal`)
@shadowmkj
shadowmkj marked this pull request as ready for review November 19, 2026 14:52
@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (b93330b) to head (c626797).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #418   +/-   ##
===========================
===========================

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sylvestre

Copy link
Copy Markdown
Collaborator

sorry but it is unlikely that we will take add this dependency over similar

@shadowmkj

Copy link
Copy Markdown
Contributor Author

That's what I want to know, since similar cannot produce GNU compatible hunks? What is the solution that you are suggesting?

This crate is just temporary and for isolating the core algorithm from this repository (so I can research and play around), and it's small enough to be merged into diffutils itself. That's what I mentioned here: #415 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants