This single line probably wouldn't be noticeable, but I just get the feeling in general that LT has been slowing down and anything to reduce the memory/cpu overhead would be helpful. <br><br><font size="-1"><span class="a">
<a href="http://ez.no/content/download/134087/853115/version/2/file/ez2006_high_perfromance_">ez.no/content/download/134087/853115/version/2/file/ez2006_high_perfromance_</a><b>php</b>.pdf<br><br>has some information regarding preg_replace vs str_replace... it is also just a really good presentation.
<br></span></font><br>I don't mean to nit-pick, I was just trying to point something out that perhaps hadn't been thought about.<br><br>-Matt<br><br><div><span class="gmail_quote">On 2/5/07, <b class="gmail_sendername">
Jon Daley</b> <<a href="mailto:plogworld@jon.limedaley.com">plogworld@jon.limedaley.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I haven't done any tests with it - how much memory/resources does<br>it use? If it is significant, maybe we should just use str_replace.<br>Oscar - does the string you are searching have a http:// prefix? If so,
<br>we could use str_replace, but search for "<a href="http://www">http://www</a>." instead of just<br>"www."<br><br>On Mon, 5 Feb 2007, Matt Wood wrote:<br>> ugh. I'm an iddiot. Reading top down or something.
<br>><br>> On 2/5/07, Matt Wood <<a href="mailto:matt@woodzy.com">matt@woodzy.com</a>> wrote:<br>>><br>>> preg_replace take significantly more time (and memory) to execute than<br>>> str_replace... just wondering what your rationale for this was...
<br>>><br>>> From PHP Website:<br>>> mixed *str_replace* ( mixed search, mixed replace, mixed subject [, int<br>>> &count] )<br>>> This function returns a string or an array with all occurrences of *search
<br>>> * in *subject* replaced with the given *replace* value. If you don't need<br>>> fancy replacing rules (like regular expressions), you should always use<br>>> this<br>>> function instead of
<br>>> ereg_replace()<<a href="http://hu.php.net/manual/en/function.ereg-replace.php">http://hu.php.net/manual/en/function.ereg-replace.php</a>>or<br>>> preg_replace() <<a href="http://hu.php.net/manual/en/function.preg-replace.php">
http://hu.php.net/manual/en/function.preg-replace.php</a>>.<br>>><br>>> On 2/5/07, <a href="mailto:oscar@devel.lifetype.net">oscar@devel.lifetype.net</a> <<a href="mailto:oscar@devel.lifetype.net">oscar@devel.lifetype.net
</a>> wrote:<br>>> ><br>>> > Author: oscar<br>>> > Date: 2007-02-05 17:15:16 -0500 (Mon, 05 Feb 2007)<br>>> > New Revision: 4693<br>>> ><br>>> > Modified:<br>>> > plog/branches/lifetype-
1.2<br>>> > /class/net/http/session/sessionmanager.class.php<br>>> > Log:<br>>> > Added Jon's fix<br>>> ><br>>> ><br>>> > Modified: plog/branches/lifetype-1.2<br>>> > /class/net/http/session/sessionmanager.class.php
<br>>> > ===================================================================<br>>> > ---<br>>> plog/branches/lifetype-1.2/class/net/http/session/sessionmanager.class.php<br>>> 2007-02-05<br>>> > 21:49:03 UTC (rev 4692)
<br>>> > +++<br>>> plog/branches/lifetype-1.2/class/net/http/session/sessionmanager.class.php<br>>> 2007-02-05<br>>> > 22:15:16 UTC (rev 4693)<br>>> > @@ -104,7 +104,7 @@<br>>> > $scriptUrl = HttpVars::getBaseUrl();
<br>>> ><br>>> > $url = new Url( $scriptUrl );<br>>> > - $domain = str_replace( "www.", ".",<br>>> > $url->getHost());
<br>>> > + $domain = preg_replace("/^www\./", ".",<br>>> > $url->getHost());<br>>> ><br>>> > // this won't work for top level domains and
<br>>> > domains such as<br>>> > // 'localhost' or internal domains for obvious<br>>> > security reasons...<br>>> ><br>>> > _______________________________________________
<br>>> > pLog-svn mailing list<br>>> > <a href="mailto:pLog-svn@devel.lifetype.net">pLog-svn@devel.lifetype.net</a><br>>> > <a href="http://limedaley.com/mailman/listinfo/plog-svn">http://limedaley.com/mailman/listinfo/plog-svn
</a><br>>> ><br>>><br>>><br>><br><br>--<br>Jon Daley<br><a href="http://jon.limedaley.com/">http://jon.limedaley.com/</a><br><br>I have never met a man so ignorant that<br>I couldn't learn something from him.
<br>-- Galileo Galilei<br>_______________________________________________<br>pLog-svn mailing list<br><a href="mailto:pLog-svn@devel.lifetype.net">pLog-svn@devel.lifetype.net</a><br><a href="http://limedaley.com/mailman/listinfo/plog-svn">
http://limedaley.com/mailman/listinfo/plog-svn</a><br></blockquote></div><br>