php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18826 slow string search (strpos,ereg etc.)
Submitted: 2002-08-09 04:05 UTC Modified: 2002-09-21 01:53 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: potsataja at future dot ee Assigned:
Status: No Feedback Package: Strings related
PHP Version: 4.2.2 OS: linux, redhat 7.2
Private report: No CVE-ID: None
 [2002-08-09 04:05 UTC] potsataja at future dot 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-13 21:56 UTC] kalowsky@php.net
Can you please try a CVS version?  I believe this is/has been  addressed already, but I'm unsure. 
 [2002-08-14 05:04 UTC] potsataja at future dot ee
nope, thats impossible, because its a public server with many clients.
 [2002-08-14 18:28 UTC] 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-15 01:48 UTC] potsataja at future dot ee
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..
 [2002-08-15 11:20 UTC] kalowsky@php.net
Okay lets try this again.

1) A simple sample script.  Give us the most basic sample script you can create to reproduce this.  

2) Even with your sample scripts I don't see any real slowness to it.  You need to quantify the word slow.   Off my DSL line your page loaded up fairly quickly once your DNS was  resolved.
 [2002-09-21 01:53 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 12:01:29 2024 UTC