From: Brion Vibber Date: Thu, 4 Nov 2004 23:53:44 +0000 (+0000) Subject: Optimization on cleanUp(): roughly 1/3 speed boost on ascii-dominant but not ascii... X-Git-Tag: 1.5.0alpha1~1402 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=48cb181bd26cb14cff803a43ba1fb7508241ab72;p=lhc%2Fweb%2Fwiklou.git Optimization on cleanUp(): roughly 1/3 speed boost on ascii-dominant but not ascii-pure text (eg German) --- diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index 08bc17bc17..0737823ee1 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 ) {