Compare lines 629 and 681 in the attached screenshot.
Revisions and Commits
- Mentioned In
- D19748: Skip copied code detection for changes that are too large for it to be useful
T13137: Plans: 2018 Week 19 - Week 22 Bonus Content
- Mentioned Here
- D19442: Raise the intraline diff hard limit from 80 to 100 characters
D19424: Omit "type" attribute from "<source />" tags in "<video>" to trick Chrome into playing them
T2312: Modifying PHP
T8227: Why not just add an option/setting/preference?
The intraline diff algorithm is O(n^2) (I believe this can't be improved much) and runs in PHP which gives it a huge runtime constant (this could be improved, but at the cost of making installation much more complicated). To avoid skyrocketing performance costs, we bail out rather than computing intraline differences if the changed span is too large. Specifically, the algorithm:
- Takes the old and new strings, A and B;
- computes the length of the shared prefix (if any) and shared suffix (if any); and
- if the remaining string length between the prefix and suffix is more than 80 characters, bails out and marks the whole line as changed.
The bailout code is here:
So this is currently working as intended. We could probably make the cutoff configurable, though, and possibly port it to C some day...
D19442 is marked as fixing this, although it just raises the limit from 80 to 100. This span measures the number of characters between the first changed character and the last changed character (not the total number of characters on the line) and we haven't seen tons of interest in this over the last several years so I think few installs are running into issues with it even at 80. Bumping it to 100 should give us a bit more breathing room but I don't currently plan to make it configurable (see T8227).
Self-hosted installs are free to change 100 to some other number, just be aware that the cost rises with O(N^2).
Some day, we will likely port this to C (see T2312) and be able to raise the limit to some much larger value (perhaps 512 or similar) if you install the companion extension.