From: Brion Vibber Date: Sat, 30 Oct 2004 12:35:37 +0000 (+0000) Subject: The pass-by-reference on the string on fastCompose() really slows things down sometim... X-Git-Tag: 1.5.0alpha1~1414 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=1897c54f2afe4fbb293eb930273fbba878de75fb;p=lhc%2Fweb%2Fwiklou.git The pass-by-reference on the string on fastCompose() really slows things down sometimes in PHP4. Taking it out speeds up processing of Japanese text significantly. --- diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index b1664fa6dc..5e31294a64 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -417,11 +417,11 @@ class UtfNormal { * (depending on which decomposition map is passed to us). * Input is assumed to be *valid* UTF-8. Invalid code will break. * @access private - * @param string &$string Valid UTF-8 string - * @param array &$map hash of expanded decomposition map + * @param string $string Valid UTF-8 string + * @param array $map hash of expanded decomposition map * @return string a UTF-8 string decomposed, not yet normalized (needs sorting) */ - function fastDecompose( &$string, &$map ) { + function fastDecompose( $string, &$map ) { UtfNormal::loadData(); $len = strlen( $string ); $out = ''; @@ -445,6 +445,7 @@ class UtfNormal { } if( isset( $map[$c] ) ) { $out .= $map[$c]; + continue; } else { if( $c >= UTF8_HANGUL_FIRST && $c <= UTF8_HANGUL_LAST ) { # Decompose a hangul syllable into jamo; @@ -465,10 +466,10 @@ class UtfNormal { } elseif( $t ) { $out .= "\xe1\x86" . chr( 0xa7 + $t ); } - } else { - $out .= $c; + continue; } } + $out .= $c; } return $out; }