https://bugzilla.wikimedia.org/show_bug.cgi?id=47989

       Web browser: ---
            Bug ID: 47989
           Summary: Significant time optimisation of WordLevelDiff._split
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: minor
          Priority: Unprioritized
         Component: History/Diffs
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Hello!

I faced a problem, that difference involving many lines fails to be rendered in
60 seconds. The reason turned out to be in overhead in method
WordLevelDiff._split (file includes/diff/DairikiDiff.php).

$words = array_merge( $words, $m[0] );
$stripped = array_merge( $stripped, $m[1] );

Call of array_merge happens for each line of difference. array_merge is acting
too slow, since it involves copying its arguments.

I replaced this two lines with:
foreach ($m[0] as $k) { $words []= $k; }
foreach ($m[1] as $k) { $stripped []= $k; }

This results in significant speed-up of difference rendering (from more than 60
seconds to less than one second).

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to