Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit a77282f

Browse files
committed
[[ Diff ]] Efficiency improvements: inline snake function calls
1 parent a922e59 commit a77282f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

extensions/script-libraries/diff/diff.livecodescript

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,18 @@ private command compare_diagonal @pFP, @pPath, @pA, pALength, @pB, pBLength, k
551551
put tPrevPath & tNext-k,tOperation,tNext & cr into pPath[k]
552552
end if
553553
local tP
554-
put snake(pA, pALength, pB, pBLength, k, tNext) into pFP[k]
554+
--put snake(pA, pALength, pB, pBLength, k, tNext) into pFP[k]
555+
556+
-- inline snake function
557+
set the caseSensitive to true
558+
set the formSensitive to true
559+
local tLimit
560+
put min(pALength + k, pBLength) into tLimit
561+
repeat while (tNext < tLimit) and pA[tNext - k + 1] is pB[tNext + 1]
562+
add 1 to tNext
563+
end repeat
564+
565+
put tNext into pFP[k]
555566
end compare_diagonal
556567

557568
private function snake @pA, pALength, @pB, pBLength, k, y

0 commit comments

Comments
 (0)