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: