Last modified: 2013-07-25 09:00:37 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T49989, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 47989 - Significant time optimisation of WordLevelDiff._split
Significant time optimisation of WordLevelDiff._split
Status: PATCH_TO_REVIEW
Product: MediaWiki
Classification: Unclassified
History/Diffs (Other open bugs)
1.22.0
All All
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
: performance
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-02 11:04 UTC by Boris
Modified: 2013-07-25 09:00 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Boris 2013-05-02 11:04:47 UTC
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).
Comment 1 Andre Klapper 2013-05-02 13:47:37 UTC
Hi! Thanks for your bug report!

You are welcome to use Developer access
  https://www.mediawiki.org/wiki/Developer_access
to submit this change as a Git branch directly into Gerrit:
  https://www.mediawiki.org/wiki/Git/Tutorial
Putting your branch in Git makes it easier to review it quickly.
Thanks again! We appreciate your contribution.
Comment 2 Boris 2013-05-02 14:44:54 UTC
https://gerrit.wikimedia.org/r/61983
Comment 3 Andre Klapper 2013-05-03 09:03:55 UTC
Thanks, Boris! Looks like Jenkins failed for that patch, plus would be great if you could mention the corresponding bug number in the patch's commit message. See http://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines
Comment 4 Boris 2013-05-03 10:35:47 UTC
Hey, Andre Klapper!

Bug number was mentioned in the patch's commit message. Jenkins-bot now reports build succeeded.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links