Fossil SCM
Add a #define for the diff block alignment algorithm threshold.
Commit
0a4ae4408efc839a4e61b9ca9f252e6dd33fab979ca6cc8b6f9e7a025ae3b086
Parent
9e330740ccfc628…
1 file changed
+8
-1
+8
-1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -1733,10 +1733,17 @@ | ||
| 1733 | 1733 | b.n = (int)strlen(b.z); |
| 1734 | 1734 | x = match_dline(&a, &b); |
| 1735 | 1735 | fossil_print("%d\n", x); |
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | +/* | |
| 1739 | +** The threshold at which diffBlockAlignment transitions from the | |
| 1740 | +** O(N*N) Wagner minimum-edit-distance algorithm to a less process | |
| 1741 | +** O(NlogN) divide-and-conquer approach. | |
| 1742 | +*/ | |
| 1743 | +#define DIFF_ALIGN_MX 1225 | |
| 1744 | + | |
| 1738 | 1745 | /* |
| 1739 | 1746 | ** There is a change block in which nLeft lines of text on the left are |
| 1740 | 1747 | ** converted into nRight lines of text on the right. This routine computes |
| 1741 | 1748 | ** how the lines on the left line up with the lines on the right. |
| 1742 | 1749 | ** |
| @@ -1791,11 +1798,11 @@ | ||
| 1791 | 1798 | ** O(NlogN). The result is not as precise, but this whole thing is an |
| 1792 | 1799 | ** approximation anyhow, and the faster response time is an acceptable |
| 1793 | 1800 | ** trade-off for reduced precision. |
| 1794 | 1801 | */ |
| 1795 | 1802 | mnLen = nLeft<nRight ? nLeft : nRight; |
| 1796 | - if( nLeft*nRight>1000 && (diffFlags & DIFF_SLOW_SBS)==0 ){ | |
| 1803 | + if( nLeft*nRight>DIFF_ALIGN_MX && (diffFlags & DIFF_SLOW_SBS)==0 ){ | |
| 1797 | 1804 | const DLine *aSmall; /* The smaller of aLeft and aRight */ |
| 1798 | 1805 | const DLine *aBig; /* The larger of aLeft and aRight */ |
| 1799 | 1806 | int nSmall, nBig; /* Size of aSmall and aBig. nSmall<=nBig */ |
| 1800 | 1807 | int iDivSmall, iDivBig; /* Divider point for aSmall and aBig */ |
| 1801 | 1808 | int iDivLeft, iDivRight; /* Divider point for aLeft and aRight */ |
| 1802 | 1809 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1733,10 +1733,17 @@ | |
| 1733 | b.n = (int)strlen(b.z); |
| 1734 | x = match_dline(&a, &b); |
| 1735 | fossil_print("%d\n", x); |
| 1736 | } |
| 1737 | |
| 1738 | /* |
| 1739 | ** There is a change block in which nLeft lines of text on the left are |
| 1740 | ** converted into nRight lines of text on the right. This routine computes |
| 1741 | ** how the lines on the left line up with the lines on the right. |
| 1742 | ** |
| @@ -1791,11 +1798,11 @@ | |
| 1791 | ** O(NlogN). The result is not as precise, but this whole thing is an |
| 1792 | ** approximation anyhow, and the faster response time is an acceptable |
| 1793 | ** trade-off for reduced precision. |
| 1794 | */ |
| 1795 | mnLen = nLeft<nRight ? nLeft : nRight; |
| 1796 | if( nLeft*nRight>1000 && (diffFlags & DIFF_SLOW_SBS)==0 ){ |
| 1797 | const DLine *aSmall; /* The smaller of aLeft and aRight */ |
| 1798 | const DLine *aBig; /* The larger of aLeft and aRight */ |
| 1799 | int nSmall, nBig; /* Size of aSmall and aBig. nSmall<=nBig */ |
| 1800 | int iDivSmall, iDivBig; /* Divider point for aSmall and aBig */ |
| 1801 | int iDivLeft, iDivRight; /* Divider point for aLeft and aRight */ |
| 1802 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1733,10 +1733,17 @@ | |
| 1733 | b.n = (int)strlen(b.z); |
| 1734 | x = match_dline(&a, &b); |
| 1735 | fossil_print("%d\n", x); |
| 1736 | } |
| 1737 | |
| 1738 | /* |
| 1739 | ** The threshold at which diffBlockAlignment transitions from the |
| 1740 | ** O(N*N) Wagner minimum-edit-distance algorithm to a less process |
| 1741 | ** O(NlogN) divide-and-conquer approach. |
| 1742 | */ |
| 1743 | #define DIFF_ALIGN_MX 1225 |
| 1744 | |
| 1745 | /* |
| 1746 | ** There is a change block in which nLeft lines of text on the left are |
| 1747 | ** converted into nRight lines of text on the right. This routine computes |
| 1748 | ** how the lines on the left line up with the lines on the right. |
| 1749 | ** |
| @@ -1791,11 +1798,11 @@ | |
| 1798 | ** O(NlogN). The result is not as precise, but this whole thing is an |
| 1799 | ** approximation anyhow, and the faster response time is an acceptable |
| 1800 | ** trade-off for reduced precision. |
| 1801 | */ |
| 1802 | mnLen = nLeft<nRight ? nLeft : nRight; |
| 1803 | if( nLeft*nRight>DIFF_ALIGN_MX && (diffFlags & DIFF_SLOW_SBS)==0 ){ |
| 1804 | const DLine *aSmall; /* The smaller of aLeft and aRight */ |
| 1805 | const DLine *aBig; /* The larger of aLeft and aRight */ |
| 1806 | int nSmall, nBig; /* Size of aSmall and aBig. nSmall<=nBig */ |
| 1807 | int iDivSmall, iDivBig; /* Divider point for aSmall and aBig */ |
| 1808 | int iDivLeft, iDivRight; /* Divider point for aLeft and aRight */ |
| 1809 |