my fork of dmp
Preparing for non-beta release
Anubhab Bandyopadhyay 2024-09-02
parent 521e6e4 · commit 3cac64f
-rw-r--r--CHANGELOG.md17
-rw-r--r--Cargo.toml1
-rw-r--r--README.md16
-rw-r--r--src/lib.rs17
4 files changed, 37 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..8e3723a
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,17 @@
+# CHANGELOG.md
+
+## 0.2.0
+
+Features:
+
+ - stabilizing APIs & coming out of beta
+ - removes dependency burden on `chrono` for non-wasm targets - minor performance improvements for non-wasm targets
+ - tested and added more targets
+
+Fix:
+
+ - Fixes a panic [Issue](https://github.com/AnubhabB/diff-match-patch-rs/issues/2)
+
+General:
+
+ - elaborate compatibility tests with python, go and js libs. [Here](https://github.com/AnubhabB/diff-match-patch-rs-bench) \ No newline at end of file
diff --git a/Cargo.toml b/Cargo.toml
index e1249a1..5b035fe 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,7 @@ name = "diff-match-patch-rs"
version = "0.2.0"
edition = "2021"
authors = ["Anubhab Bandyopadhyay"]
+homepage = "https://docs.rs/diff-match-patch-rs"
repository = "https://github.com/AnubhabB/diff-match-patch-rs.git"
description = "A high-performance port of Myer's diff algorithm to perform the operations required for synchronizing plain text."
readme = "README.md"
diff --git a/README.md b/README.md
index e544a4c..f5fb2b3 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ A very **fast**, **accurate** and **wasm ready** port of [Diff Match Patch](http
```toml
[dependencies]
-diff-match-patch-rs = "0.1.0-beta.4"
+diff-match-patch-rs = "0.2.0"
```
### `Effitient` mode
@@ -160,19 +160,23 @@ Benchmarks are maintained [diff-match-patch-bench repository](https://github.com
| Lang. | Library | Diff Avg. | Patch Avg. | Bencher | Mode | Correct |
|:-------:|:----------------------------------------------------------------------------------------:|:---------:|:----------:|:----------:|:-----------:|:-------:|
| `rust` | [diff_match_patch v0.1.1](https://crates.io/crates/diff_match_patch)[^2] | 68.108 ms | 10.596 ms | Criterion | - | ✅ |
-| `rust` | [diffmatchpatch v0.0.4](https://crates.io/crates/diffmatchpatch)[^3] | 66.454 ms | - | Criterion | - | ❌ |
| `rust` | [dmp v0.2.0](https://crates.io/crates/dmp) | 69.019 ms | 14.654 ms | Criterion | - | ✅ |
-| `rust` | [diff-match-patch-rs](https://github.com/AnubhabB/diff-match-patch-rs.git)<sup>our</sup> | 65.487 ms | 631.13 µs | Criterion | `Efficient` | ✅ |
-| `rust` | [diff-match-patch-rs](https://github.com/AnubhabB/diff-match-patch-rs.git)<sup>our</sup> | 65.642 ms | 1.1703 ms | Criterion | `Compat` | ✅ |
-| `go` | [go-diff](https://github.com/sergi/go-diff)[^1] | 50.31 ms | 135.2 ms | go test | - | ❌ |
+| `rust` | [diff-match-patch-rs](https://github.com/AnubhabB/diff-match-patch-rs.git)<sup>our</sup> | 64.66 ms | 631.13 µs | Criterion | `Efficient` | ✅ |
+| `rust` | [diff-match-patch-rs](https://github.com/AnubhabB/diff-match-patch-rs.git)<sup>our</sup> | 64.68 ms | 1.1703 ms | Criterion | `Compat` | ✅ |
+| `go` | [go-diff](https://github.com/sergi/go-diff)[^1] | 50.31 ms | 135.2 ms | go test | - | ❌ |
| `node` | [diff-match-patch](https://www.npmjs.com/package/diff-match-patch) | 246.90 ms | 1.07 ms | tinybench | - | ✅ |
| `python`| [diff-match-patch](https://pypi.org/project/diff-match-patch/) | 1.01 s | 0.25 ms | timeit | - | ✅ |
[^1]: [go-diff](https://github.com/sergi/go-diff) seems to generate wrong diffs for emoticons. This benchmark is on the text with the emoticons removed.
[^2]: Adds an extra clone to the iterator because the `patch_apply` method takes mutable refc. to `diffs`.
-[^3]: The crate [diffmatchpatch v0.0.4](https://crates.io/crates/diffmatchpatch) is still a WIP, cound't find the `patch_apply` method.
+## Gotchas
+**Diff incompatibility with `JavaScript` libs**:
+
+There are 2 kinds of implementations - one which use a `postprocessing` function for merging `unicode surrogates` which break compatibility with every other popular `diff-match-patch` implementations and the other kind (packages based on the original implementation) break while `urlEncode()` of unicode surrogates.
+As of now, this crate brakes compatibility while working with `JS` generated diffs with the surrogate patch.
+If you are interfacing with `JavaScript` in browser, using this crate through `wasm` would be ideal.
## Related projects
diff --git a/src/lib.rs b/src/lib.rs
index f94f554..727aea5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,7 +23,7 @@
//!
//! ```toml
//! [dependencies]
-//! diff-match-patch-rs = "0.1.0-beta.3"
+//! diff-match-patch-rs = "0.2.0"
//! ```
//!
//! ### `Effitient` mode
@@ -162,19 +162,20 @@
//! | Lang. | Library | Diff Avg. | Patch Avg. | Bencher | Mode | Correct |
//! |:-------:|:----------------------------------------------------------------------------------------:|:---------:|:----------:|:----------:|:-----------:|:-------:|
//! | `rust` | [diff_match_patch v0.1.1](https://crates.io/crates/diff_match_patch)[^2] | 68.108 ms | 10.596 ms | Criterion | - | ✅ |
-//! | `rust` | [diffmatchpatch v0.0.4](https://crates.io/crates/diffmatchpatch)[^3] | 66.454 ms | - | Criterion | - | ❌ |
//! | `rust` | [dmp v0.2.0](https://crates.io/crates/dmp) | 69.019 ms | 14.654 ms | Criterion | - | ✅ |
-//! | `rust` | [diff-match-patch-rs](https://github.com/AnubhabB/diff-match-patch-rs.git)<sup>our</sup> | 65.487 ms | 631.13 µs | Criterion | `Efficient` | ✅ |
-//! | `rust` | [diff-match-patch-rs](https://github.com/AnubhabB/diff-match-patch-rs.git)<sup>our</sup> | 65.642 ms | 1.1703 ms | Criterion | `Compat` | ✅ |
-//! | `go` | [go-diff](https://github.com/sergi/go-diff)[^1] | 50.31 ms | 135.2 ms | go test | - | ❌ |
+//! | `rust` | [diff-match-patch-rs](https://github.com/AnubhabB/diff-match-patch-rs.git)<sup>our</sup> | 64.66 ms | 631.13 µs | Criterion | `Efficient` | ✅ |
+//! | `rust` | [diff-match-patch-rs](https://github.com/AnubhabB/diff-match-patch-rs.git)<sup>our</sup> | 64.68 ms | 1.1703 ms | Criterion | `Compat` | ✅ |
+//! | `go` | [go-diff](https://github.com/sergi/go-diff)[^1] | 50.31 ms | 135.2 ms | go test | - | ❌ |
//! | `node` | [diff-match-patch](https://www.npmjs.com/package/diff-match-patch) | 246.90 ms | 1.07 ms | tinybench | - | ✅ |
//! | `python`| [diff-match-patch](https://pypi.org/project/diff-match-patch/) | 1.01 s | 0.25 ms | timeit | - | ✅ |
//!
//!
-//! [^1]: [go-diff](https://github.com/sergi/go-diff) seems to generate wrong diffs for emoticons. This benchmark is on the text with the emoticons removed.
-//! [^2]: Adds an extra clone to the iterator because the `patch_apply` method takes mutable refc. to `diffs`.
-//! [^3]: The crate [diffmatchpatch v0.0.4](https://crates.io/crates/diffmatchpatch) is still a WIP, cound't find the `patch_apply` method.
+//! ## Gotchas
+//! **Diff incompatibility with `JavaScript` libs**:
//!
+//! There are 2 kinds of implementations - one which use a `postprocessing` function for merging `unicode surrogates` which break compatibility with every other popular `diff-match-patch` implementations and the other kind (packages based on the original implementation) break while `urlEncode()` of unicode surrogates.
+//! As of now, this crate brakes compatibility while working with `JS` generated diffs with the surrogate patch.
+//! If you are interfacing with `JavaScript` in browser, using this crate through `wasm` would be ideal.
//!
pub mod dmp;