jenkins-bot has submitted this change and it was merged.

Change subject: DairikiDiff: Optimise method WordLevelDiff._split()
......................................................................


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
---
M includes/diff/DairikiDiff.php
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Tim Starling: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/diff/DairikiDiff.php b/includes/diff/DairikiDiff.php
index 4435fc6..174c1d6 100644
--- a/includes/diff/DairikiDiff.php
+++ b/includes/diff/DairikiDiff.php
@@ -1284,8 +1284,12 @@
                                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;
+                                       }
                                }
                        }
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/61983
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I41338a2a82fbc20d7511f4c79581880febeeeea5
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Oantnri <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Oantnri <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to