Improve performance of difflib. (#1)

* Improve performance of difflib, primarily by avoiding heap allocations.

* Add doc comment to real_quick_ratio.
This commit is contained in:
David Stern
2024-06-03 14:11:35 -04:00
committed by GitHub
parent f035fb8e65
commit 114177e7d8
4 changed files with 40 additions and 8 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ use difflib::sequencematcher::{Match, Opcode, SequenceMatcher};
#[test]
fn test_longest_match() {
let matcher = SequenceMatcher::new(" abcd", "abcd abcd");
let mut matcher = SequenceMatcher::new(" abcd", "abcd abcd");
let m = matcher.find_longest_match(0, 5, 0, 9);
assert_eq!(m.first_start, 0);
assert_eq!(m.second_start, 4);