diff options
author | Brion Vibber <brion@users.mediawiki.org> | 2004-10-30 12:35:37 +0000 |
---|---|---|
committer | Brion Vibber <brion@users.mediawiki.org> | 2004-10-30 12:35:37 +0000 |
commit | 1897c54f2afe4fbb293eb930273fbba878de75fb (patch) | |
tree | f4cfcf160906439e57652731e55a915eb1f7adce /includes/normal | |
parent | ca8ef41fbb6ed9ad8e41bca16ff8ea205ea6c683 (diff) | |
download | mediawikicore-1897c54f2afe4fbb293eb930273fbba878de75fb.tar.gz mediawikicore-1897c54f2afe4fbb293eb930273fbba878de75fb.zip |
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.
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/6136
Diffstat (limited to 'includes/normal')
-rw-r--r-- | includes/normal/UtfNormal.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index b1664fa6dc15..5e31294a649b 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; } |