note 76725 added to function.mb-strlen

From: Date: Fri, 27 Jul 2007 19:19:00 +0000
Subject: note 76725 added to function.mb-strlen
Groups: php.notes 
Request: Send a blank email to php-notes+get-128993@lists.php.net to get a copy of this message
Just did a little benchmarking (1.000.000 times with lorem ipsum text) on the mbs functions especially mb_strtolower and mb_strtoupper are really slow (up to 100 times slower compared to normal functions). Other functions are alike-ish, but sometimes up to 5 times slower. just be cautious when using mb_ functions in high frequented scripts. # test runs: 1000000 # benchmarking strlen vs. mb_strlen # normal strlen: 3.6795361042023 ms, average: 3.6795361042023E-6 ms # mb_strlen: 5.5934538841248 ms, average: 5.5934538841248E-6 ms ok 1 - mb_strlen is slower than strlen # mb_strlen is 1.52 slower than strlen # # # benchmarking strpos vs. mb_strpos # normal strpos: 5.5523281097412 ms, average: 5.5523281097412E-6 ms # mb_strlen: 31.180974960327 ms, average: 3.1180974960327E-5 ms ok 2 - mb_strlen is slower than strlen # mb_strpos is 5.62 slower than strpos # # # benchmarking substr vs. mb_substr # normal substr: 3.4437320232391 ms, average: 3.4437320232391E-6 ms # mb_strlen: 3.5374181270599 ms, average: 3.5374181270599E-6 ms ok 3 - mb_strlen is slower than strlen # mb_substr is 1.03 slower than substr # # # benchmarking strtolower vs. mb_strtolower # normal strtolower: 4.446839094162 ms, average: 4.446839094162E-6 ms # mb_strlen: 193.44901108742 ms, average: 0.00019344901108742 ms ok 4 - mb_strlen is slower than strlen # mb_strtolower is 43.5 slower than strtolower # # # benchmarking strtoupper vs. mb_strtoupper # normal strtoupper: 3.0210740566254 ms, average: 3.0210740566254E-6 ms # mb_strlen: 340.71775603294 ms, average: 0.00034071775603294 ms ok 5 - mb_strlen is slower than strlen # mb_strtoupper is 112.78 slower than strtoupper ---- Server IP: 217.13.201.10 Probable Submitter: 87.79.194.13 ---- Manual Page -- http://www.php.net/manual/en/function.mb-strlen.php Edit -- https://master.php.net/note/edit/76725 Del: integrated -- https://master.php.net/note/delete/76725/integrated Del: useless -- https://master.php.net/note/delete/76725/useless Del: bad code -- https://master.php.net/note/delete/76725/bad+code Del: spam -- https://master.php.net/note/delete/76725/spam Del: non-english -- https://master.php.net/note/delete/76725/non-english Del: in docs -- https://master.php.net/note/delete/76725/in+docs Del: other reasons-- https://master.php.net/note/delete/76725 Reject -- https://master.php.net/note/reject/76725 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128993) next »