Last modified: 2014-03-11 13:49:39 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 T61840, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 59840 - jsdiff uses excessive time / memory on pages with a lot of lines
jsdiff uses excessive time / memory on pages with a lot of lines
Status: ASSIGNED
Product: Parsoid
Classification: Unclassified
tests (Other open bugs)
unspecified
All All
: Normal normal
: ---
Assigned To: bebirchall
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-08 22:25 UTC by Gabriel Wicke
Modified: 2014-03-11 13:49 UTC (History)
4 users (show)

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


Attachments

Description Gabriel Wicke 2014-01-08 22:25:26 UTC
jsdiff runs out of memory when diffing pages with a lot of wikitext lines. Test case:

node  roundtrip-test.js --prefix zhwiki '2011年香港區議會選舉結果'

After a cursory inspection it looks as if the algorithm will use memory bounded by O(l^2) with l being the number of lines in the page.

We could either try to optimize (afaik there is no bug) jsdiff, or we could consider switching to another diff library such as https://github.com/paulgb/simplediff.
Comment 1 Gabriel Wicke 2014-01-08 22:27:06 UTC
This is split out of bug 58952, which has some more example pages.
Comment 2 bebirchall 2014-03-04 19:00:02 UTC
Resolved by patch "Use simplediff to diff rt-server test results" https://gerrit.wikimedia.org/r/#/c/115985/
Comment 3 Gabriel Wicke 2014-03-04 19:06:23 UTC
(In reply to bebirchall from comment #2)
> Resolved by patch "Use simplediff to diff rt-server test results"
> https://gerrit.wikimedia.org/r/#/c/115985/

This resolves the issue in roundtrip-test.js.

The various round-trip end points in the web service however still suffer from this problem, so it would be great to move to simplediff there too. This would also give us consistent diff behavior between rt testing and the web service. Some differences are discussed in https://gist.github.com/bebebebebe/9213456.

It would be great to move all diff-related functionality into a separate diff module rather than dropping it all into Util. This makes it easy to reuse the diffing functionality separately.
Comment 4 bebirchall 2014-03-11 13:49:39 UTC
Patch to resolve issue in web service: "Use simplediff in web service and move diff functions into diff module": https://gerrit.wikimedia.org/r/#/c/118023/

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


Navigation
Links