@@ -3518,6 +3518,7 @@ process.umask = function() { return 0; };
35183518 matching : 'none' ,
35193519 matchWordsThreshold : 0.25 ,
35203520 matchingMaxComparisons : 2500 ,
3521+ maxLineSizeInBlockForComparison : 200 ,
35213522 maxLineLengthHighlight : 10000 ,
35223523 renderNothingWhenEmpty : false
35233524 } ;
@@ -3881,9 +3882,17 @@ process.umask = function() { return 0; };
38813882 var deleteType ;
38823883
38833884 var comparisons = oldLines . length * newLines . length ;
3884- var maxComparisons = that . config . matchingMaxComparisons || 2500 ;
3885- var doMatching = comparisons < maxComparisons && ( that . config . matching === 'lines' ||
3886- that . config . matching === 'words' ) ;
3885+
3886+ var maxLineSizeInBlock = Math . max . apply ( null ,
3887+ [ 0 ] . concat ( ( oldLines . concat ( newLines ) ) . map (
3888+ function ( elem ) {
3889+ return elem . content . length ;
3890+ }
3891+ ) ) ) ;
3892+
3893+ var doMatching = comparisons < that . config . matchingMaxComparisons &&
3894+ maxLineSizeInBlock < that . config . maxLineSizeInBlockForComparison &&
3895+ ( that . config . matching === 'lines' || that . config . matching === 'words' ) ;
38873896
38883897 if ( doMatching ) {
38893898 matches = matcher ( oldLines , newLines ) ;
@@ -4505,9 +4514,14 @@ process.umask = function() { return 0; };
45054514 var deleteType ;
45064515
45074516 var comparisons = oldLines . length * newLines . length ;
4508- var maxComparisons = that . config . matchingMaxComparisons || 2500 ;
4509- var doMatching = comparisons < maxComparisons && ( that . config . matching === 'lines' ||
4510- that . config . matching === 'words' ) ;
4517+
4518+ var maxLineSizeInBlock = Math . max . apply ( null , ( oldLines . concat ( newLines ) ) . map ( function ( elem ) {
4519+ return elem . length ;
4520+ } ) ) ;
4521+
4522+ var doMatching = comparisons < that . config . matchingMaxComparisons &&
4523+ maxLineSizeInBlock < that . config . maxLineSizeInBlockForComparison &&
4524+ ( that . config . matching === 'lines' || that . config . matching === 'words' ) ;
45114525
45124526 if ( doMatching ) {
45134527 matches = matcher ( oldLines , newLines ) ;
0 commit comments