Last modified: 2014-09-23 23:08:02 UTC
Created attachment 7571 [details] 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.
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Unassigning default assignments. http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/54734
Can you also provide test cases?
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.