Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Difftastic | 15,447 | 4 days ago | 57 | July 27, 2023 | 143 | mit | Rust | |||
a structural diff that understands syntax 🟥🟩 | ||||||||||
Differencekit | 3,328 | 19 | 4 months ago | 21 | May 07, 2021 | 27 | apache-2.0 | Swift | ||
💻 A fast and flexible O(n) difference algorithm framework for Swift collection. | ||||||||||
Textdistance | 3,172 | 14 | 42 | a year ago | 25 | September 20, 2022 | 9 | mit | Python | |
📐 Compute distance between sequences. 30+ algorithms, pure python implementation, common interface, optional external libs usage. | ||||||||||
Dwifft | 1,767 | 26 | 3 years ago | 12 | October 22, 2018 | 18 | mit | Swift | ||
Swift Diff | ||||||||||
Diff.swift | 935 | 20 | 5 years ago | 7 | September 30, 2017 | 8 | mit | Swift | ||
The fastest Diff and patch library in Swift. Includes UICollectionView/UITableView utils. | ||||||||||
Nanomorph | 710 | 225 | 65 | 2 years ago | 33 | February 18, 2021 | 17 | mit | JavaScript | |
🚅 - Hyper fast diffing algorithm for real DOM nodes | ||||||||||
Diffabledatasources | 619 | 2 years ago | 4 | June 08, 2021 | 13 | apache-2.0 | Swift | |||
💾 A library for backporting UITableView/UICollectionViewDiffableDataSource. | ||||||||||
Editscript | 423 | 6 months ago | 22 | August 25, 2022 | 11 | epl-1.0 | Clojure | |||
A library to diff and patch Clojure/ClojureScript data structures | ||||||||||
Vim Diff Enhanced | 332 | 3 years ago | Vim script | |||||||
Better Diff options for Vim | ||||||||||
Diff Lcs | 263 | 214,363 | 323 | a year ago | 16 | December 23, 2021 | 5 | other | Ruby | |
Generate difference sets between Ruby sequences. |
Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities to create a simple HTML diff output format and a standard diff-like tool.
This is release 1.4.3, providing a simple extension that allows for Diff::LCS::Change objects to be treated implicitly as arrays and fixes a number of formatting issues.
Ruby versions below 2.5 are soft-deprecated, which means that older versions are no longer part of the CI test suite. If any changes have been introduced that break those versions, bug reports and patches will be accepted, but it will be up to the reporter to verify any fixes prior to release. The next major release will completely break compatibility.
Using this module is quite simple. By default, Diff::LCS does not extend objects with the Diff::LCS interface, but will be called as if it were a function:
require 'diff/lcs' seq1 = %w(a b c e h j l m n p) seq2 = %w(b c d e f j k l m r s t) lcs = Diff::LCS.LCS(seq1, seq2) diffs = Diff::LCS.diff(seq1, seq2) sdiff = Diff::LCS.sdiff(seq1, seq2) seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj) bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj) seq2 == Diff::LCS.patch!(seq1, diffs) seq1 == Diff::LCS.unpatch!(seq2, diffs) seq2 == Diff::LCS.patch!(seq1, sdiff) seq1 == Diff::LCS.unpatch!(seq2, sdiff)
Objects can be extended with Diff::LCS:
seq1.extend(Diff::LCS) lcs = seq1.lcs(seq2) diffs = seq1.diff(seq2) sdiff = seq1.sdiff(seq2) seq = seq1.traverse_sequences(seq2, callback_obj) bal = seq1.traverse_balanced(seq2, callback_obj) seq2 == seq1.patch!(diffs) seq1 == seq2.unpatch!(diffs) seq2 == seq1.patch!(sdiff) seq1 == seq2.unpatch!(sdiff)
By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be extended for use this way.
Note that Diff::LCS requires a sequenced enumerable container, which means that the order of enumeration is both predictable and consistent for the same set of data. While it is theoretically possible to generate a diff for an unordered hash, it will only be meaningful if the enumeration of the hashes is consistent. In general, this will mean that containers that behave like String or Array will perform best.
Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt longest common subsequence (LCS) algorithm to compute intelligent differences between two sequenced enumerable containers. The implementation is based on Mario I. Wolczko's Smalltalk version 1.2 (1993) and Ned Konz's Perl version Algorithm::Diff 1.15. Diff::LCS#sdiff and Diff::LCS#traverse_balanced were originally written for the Perl version by Mike Schilli.
The algorithm is described in A Fast Algorithm for Computing Longest Common Subsequences, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor improvements to improve the speed. A simplified description of the algorithm, originally written for the Perl version, was written by Mark-Jason Dominus.