DairikiDiff: Optimise method WordLevelDiff._split()
_split() copied two arrays N times, where N is number of lines in diff. This was done by $a = array_merge($a, ...); Instead of doing this, new words are appended to the end of array using []= syntax. Bug: 47989 Change-Id: I41338a2a82fbc20d7511f4c79581880febeeeea5
This commit is contained in:
parent
a17a71b8e5
commit
c3a13553fa
1 changed files with 6 additions and 2 deletions
|
|
@ -1284,8 +1284,12 @@ class WordLevelDiff extends MappedDiff {
|
|||
if ( preg_match_all( '/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
|
||||
$line, $m ) )
|
||||
{
|
||||
$words = array_merge( $words, $m[0] );
|
||||
$stripped = array_merge( $stripped, $m[1] );
|
||||
foreach ( $m[0] as $word ) {
|
||||
$words[] = $word;
|
||||
}
|
||||
foreach ( $m[1] as $stripped_word ) {
|
||||
$stripped[] = $stripped_word;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue