#18826 [Com]: slow string search (strpos,ereg etc.)
| From: | potsataja at future dot ee | Date: | Thu, 15 Aug 2002 05:48:44 +0000 |
| Subject: | #18826 [Com]: slow string search (strpos,ereg etc.) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-16882@lists.php.net to get a copy of this message | ||
ID: 18826
Comment by: potsataja@future.ee
Reported By: potsataja@future.ee
Status: Feedback
Bug Type: Strings related
Operating System: linux, redhat 7.2
PHP Version: 4.2.2
New Comment:
sample working script
http://potsataja.aasa.ee/bug/index.php
script source
http://potsataja.aasa.ee/bug/index.php?show=1
template file
http://potsataja.aasa.ee/bug/template.htt
hope it helps..
Previous Comments:
------------------------------------------------------------------------
[2002-08-14 18:28:03] kalowsky@php.net
Then give me a full sample script in the simplest form to reproduce
this. As your posted code only returns what I've passed into it. Even
at that, this takes a minimal amount of time to execute as a debug
build...
------------------------------------------------------------------------
[2002-08-14 05:04:11] potsataja@future.ee
nope, thats impossible, because its a public server with many clients.
------------------------------------------------------------------------
[2002-08-13 21:56:24] kalowsky@php.net
Can you please try a CVS version? I believe this is/has been
addressed already, but I'm unsure.
------------------------------------------------------------------------
[2002-08-09 04:05:39] potsataja@future.ee
Hi, i just upgraded php in my server to 4.2.2 and then problem began. I
use my own html parser (function at the bottom), what parses with new
version php very slow. I also found problem, it seems that ANY
string-search function is slower then in a older version.
------------------------------------------------
function ParseData($f,$v) {
if(defined("SID")) {
$v["SID"] = SID;
}
$n = 0;
while($s = strpos($f, "{", $n)) {
$e = strpos($f, "}", $s);
if(!is_int($e)) {
break;
}
$d = substr($f, $s+1, ($e - $s - 1));
if(!preg_match("/[[:space:]]+/", $d)) {
$f = str_replace("{".$d."}", $v[$d], $f);
}
$n++;
}
return $f;
}
---------------------------------------
i also tryd strpos function, what should be faster then regexp search
but it doesn't.
Taaniel
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18826&edit=1