Page MenuHomePhabricator

Faster algorithm to replace text with exceptions
Open, MediumPublic


I am proposing in this issue a patch to improve the algorithm to replace text with exceptions. I have found that the current algorithm process the exception regexes many times, and this can be avoided. In my tests, with my patch in long text pages I obtain significant performance improvements.

I understand this patch touches a critical part of the pywikibot code, so unit tests should be provided, but I am Python newbie and I am afraid that testing in Python is a little out of my knowledge without a bit of guidance.

I hope you could test the patch and confirm my results.


Related Gerrit Patches:
pywikibot/core : mastertextlib: Improve replace algorithm

Event Timeline

Benjavalero raised the priority of this task from to Needs Triage.
Benjavalero updated the task description. (Show Details)
Benjavalero added a project: Pywikibot.
Benjavalero changed Security from none to None.
Benjavalero added a subscriber: Benjavalero.

The patch:

XZise added a subscriber: XZise.Dec 19 2014, 11:57 PM

We use Gerrit to provide patches so it'd be appreciated if you could upload it there. This would allow us to easily test it and discuss the changes directly on the file(s).

Change 181360 had a related patch set uploaded (by Mpaa):
textlib: Improve replace algorithm


jayvdb added a subscriber: jayvdb.
jayvdb triaged this task as Medium priority.Jun 9 2015, 5:50 AM
Xqt moved this task from Backlog to Needs Review on the Pywikibot board.Feb 3 2019, 11:24 AM