Micro-optimize Language::isMultiByte()

The xenon logs on performance.wikimedia.org show this function as being on-CPU
about 1% of the time, making it a candidate for optimization. The version in
this patch is about 30-50% faster in my benchmarks.

Change-Id: I26385ade7600fc11965d94468b57e41ec257de51
This commit is contained in:
Ori Livneh 2015-08-25 18:13:14 -07:00
parent ec6ec2d67d
commit 92602fefda

View file

@ -2838,7 +2838,7 @@ class Language {
* @return bool
*/
function isMultibyte( $str ) {
return (bool)preg_match( '/[\x80-\xff]/', $str );
return strlen( $str ) !== mb_strlen( $str );
}
/**