Skip to content

Remove redundant snake computations#30

Merged
ddssff merged 1 commit into
masterfrom
optimize-snakes
Jul 2, 2026
Merged

Remove redundant snake computations#30
ddssff merged 1 commit into
masterfrom
optimize-snakes

Conversation

@ninioArtillero

Copy link
Copy Markdown
Collaborator

Current implementation (of dstep) deviates from the paper in that it extends each candidate along the available snake before comparing matching candidates.

This PR contains a refactoring that computes the extension along the snakes after matching candidates have been merged, thus voiding the computation of a significant amount of redundant snakes. Indeed, given that addsnake preserves a node's diagonal (as proved in #29), both candidates are know to be on the same diagonal before extending them, so we necessarily get the same result.

The change gives an improvent of ~40% reduction of cabal bench time (almost twice as fast), and cabal test passes.

@ddssff

ddssff commented Jul 2, 2026

Copy link
Copy Markdown
Member

I just learned of a package https://hackage.haskell.org/package/myers-diff that has benchmarks against Diff. It appears to be quite a bit faster, might be worth studying. I believe it includes patching, which we don't.

@ddssff ddssff merged commit 2ec444e into master Jul 2, 2026
12 checks passed
@ninioArtillero ninioArtillero deleted the optimize-snakes branch July 2, 2026 22:42
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