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:
parent
ec6ec2d67d
commit
92602fefda
1 changed files with 1 additions and 1 deletions
|
|
@ -2838,7 +2838,7 @@ class Language {
|
|||
* @return bool
|
||||
*/
|
||||
function isMultibyte( $str ) {
|
||||
return (bool)preg_match( '/[\x80-\xff]/', $str );
|
||||
return strlen( $str ) !== mb_strlen( $str );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue