This repository was archived by the owner on Aug 7, 2025. It is now read-only.
Commit 85b1c53
committed
Find the longest match in the suffix-sorted array
Fixes #2
The current implementation performs a binary search through the
suffix-sorted array to find byte sequence matches between old and new
files. However, the algorithm is not optimal when it repeatedly matches
very short strings, leading to performance issues as reported in issue
#2.
This commit changes the algorithm to consider *all* matches encountered
during the binary search and choose the longest of these matches.
The overall performance impact is yet to be determined, but it appears
to yield a small percentage increase in diff creation time (expected)
and a large percentage *decrease* for the case of diffing the files from
issue #2. In my testing, the creation time there decreases from approx
64 minutes to 4.5 seconds.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>1 parent d039492 commit 85b1c53
1 file changed
+38
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
97 | 114 | | |
98 | 115 | | |
99 | | - | |
100 | | - | |
101 | | - | |
| 116 | + | |
| 117 | + | |
102 | 118 | | |
103 | | - | |
104 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
105 | 123 | | |
106 | | - | |
107 | 124 | | |
| 125 | + | |
| 126 | + | |
108 | 127 | | |
109 | 128 | | |
110 | 129 | | |
111 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
112 | 143 | | |
113 | 144 | | |
114 | 145 | | |
| |||
0 commit comments