Oantnri has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/61983


Change subject: Optimisation of method WordLevelDiff._split()
......................................................................

Optimisation of 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.

Change-Id: I41338a2a82fbc20d7511f4c79581880febeeeea5
---
M includes/diff/DairikiDiff.php
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/83/61983/1

diff --git a/includes/diff/DairikiDiff.php b/includes/diff/DairikiDiff.php
index 4435fc6..10b93a8 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: newchange
Gerrit-Change-Id: I41338a2a82fbc20d7511f4c79581880febeeeea5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Oantnri <[email protected]>

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

Reply via email to