diff options
author | Brion Vibber <brion@users.mediawiki.org> | 2004-11-04 23:53:44 +0000 |
---|---|---|
committer | Brion Vibber <brion@users.mediawiki.org> | 2004-11-04 23:53:44 +0000 |
commit | 48cb181bd26cb14cff803a43ba1fb7508241ab72 (patch) | |
tree | 34718603d77389a7a109fa2eb9975cf98deca3f6 /includes/normal | |
parent | 5f530ba1f35519861cd710ca472b4b822f291d35 (diff) | |
download | mediawikicore-48cb181bd26cb14cff803a43ba1fb7508241ab72.tar.gz mediawikicore-48cb181bd26cb14cff803a43ba1fb7508241ab72.zip |
Optimization on cleanUp(): roughly 1/3 speed boost on ascii-dominant but not ascii-pure text (eg German)
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/6169
Diffstat (limited to 'includes/normal')
-rw-r--r-- | includes/normal/UtfNormal.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index 08bc17bc17fb..0737823ee12f 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -346,7 +346,15 @@ class UtfNormal { } if( $n < 0x80 ) { # Friendly ASCII chars. + # We can speed things up a bit for latin-based scripts + # where they tend to come in groups: $out .= $c; + $i++; + while( $i < $len && ( $c = $string{$i} ) < "\x80" ) { + $out .= $c; + $i++; + } + $i--; } elseif( $n < 0xc0 ) { # illegal tail bytes or head byte of overlong sequence if( $head == 0 ) { |