note 75513 added to function.substr
| From: | White-Gandalf at osu1 dot php dot net | Date: | Sun, 03 Jun 2007 11:42:26 +0000 |
| Subject: | note 75513 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127161@lists.php.net to get a copy of this message | ||
"substr" seems to be implemented in a sequential way, wasting processing power
proportional to the length of the string to be worked on and/or the position of the substring to be
extracted.
I found a speed increase by a factor of 1000 for string extraction when the original string has a
size of about 1 MB, when i replace "substr" by direct access to the chars at their index.
"Substr" should not be used for extraction of very small pieces.
----
Server IP: 69.147.83.197
Probable Submitter: 84.188.123.185
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/75513
Del: integrated -- https://master.php.net/note/delete/75513/integrated
Del: useless -- https://master.php.net/note/delete/75513/useless
Del: bad code -- https://master.php.net/note/delete/75513/bad+code
Del: spam -- https://master.php.net/note/delete/75513/spam
Del: non-english -- https://master.php.net/note/delete/75513/non-english
Del: in docs -- https://master.php.net/note/delete/75513/in+docs
Del: other reasons-- https://master.php.net/note/delete/75513
Reject -- https://master.php.net/note/reject/75513
Search -- https://master.php.net/manage/user-notes.php