Page MenuHomePhabricator

A brand new conversion core for Language Converter
Open, MediumPublicFeature

Description

Author: PhiLiP.NPC

Description:
a initial patch

I have reprogramed the core algorithm of Language Converter just now. The conversion core used an algorithm named "forwards maximum match algorithm" which was implemented in PHP by a function strtr(). The original strtr (in the C source, it's php_strtr_array) is slow because it simply finds out maxlen and minlen of all keys, then test the text to be converted from top to bottom, from long to short without any distinction.

I improved this algorithm. Fisrt I create a "quick table" to store the first char of a key and all possible length of the key. The quick table can be cached. Then I can simply check the quick table with the first char of the remain text, and just need to test all possible length of such first char. As a result, the performance improved.

Here I submit a initial patch for further testing.


Version: unspecified
Severity: enhancement

Attached:

Details

Reference
bz24409

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:10 PM
bzimport set Reference to bz24409.
bzimport added a subscriber: Unknown Object (MLST).

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

Can you also provide test cases?

sumanah wrote:

Philip, just for future reference, in case you want to submit patches to MediaWiki, https://www.mediawiki.org/wiki/Git/Tutorial shows you how to submit them directly into our source control system and bypass the Bugzilla step.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:24 PM
Aklapper removed a subscriber: wikibugs-l-list.