[pLog-svn] r4693 - plog/branches/lifetype-1.2/class/net/http/session

Matt Wood matt at woodzy.com
Wed Feb 7 13:53:05 EST 2007


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.

ez.no/content/download/134087/853115/version/2/file/ez2006_high_perfromance_
*php*.pdf

has some information regarding preg_replace vs str_replace... it is also
just a really good presentation.

I don't mean to nit-pick, I was just trying to point something out that
perhaps hadn't been thought about.

-Matt

On 2/5/07, Jon Daley <plogworld at jon.limedaley.com> wrote:
>
>         I haven't done any tests with it - how much memory/resources does
> it use?  If it is significant, maybe we should just use str_replace.
> Oscar - does the string you are searching have a http:// prefix?  If so,
> we could use str_replace, but search for "http://www." instead of just
> "www."
>
> On Mon, 5 Feb 2007, Matt Wood wrote:
> > ugh. I'm an iddiot. Reading top down or something.
> >
> > On 2/5/07, Matt Wood <matt at woodzy.com> wrote:
> >>
> >> preg_replace take significantly more time (and memory) to execute than
> >> str_replace... just wondering what your rationale for this was...
> >>
> >> From PHP Website:
> >> mixed *str_replace* ( mixed search, mixed replace, mixed subject [, int
> >> &count] )
> >> This function returns a string or an array with all occurrences of
> *search
> >> * in *subject* replaced with the given *replace* value. If you don't
> need
> >> fancy replacing rules (like regular expressions), you should always use
> >> this
> >> function instead of
> >> ereg_replace()<http://hu.php.net/manual/en/function.ereg-replace.php>or
> >> preg_replace() <http://hu.php.net/manual/en/function.preg-replace.php>.
> >>
> >> On 2/5/07, oscar at devel.lifetype.net <oscar at devel.lifetype.net> wrote:
> >> >
> >> > Author: oscar
> >> > Date: 2007-02-05 17:15:16 -0500 (Mon, 05 Feb 2007)
> >> > New Revision: 4693
> >> >
> >> > Modified:
> >> >    plog/branches/lifetype-1.2
> >> > /class/net/http/session/sessionmanager.class.php
> >> > Log:
> >> > Added Jon's fix
> >> >
> >> >
> >> > Modified: plog/branches/lifetype-1.2
> >> > /class/net/http/session/sessionmanager.class.php
> >> > ===================================================================
> >> > ---
> >> plog/branches/lifetype-1.2
> /class/net/http/session/sessionmanager.class.php
> >> 2007-02-05
> >> > 21:49:03 UTC (rev 4692)
> >> > +++
> >> plog/branches/lifetype-1.2
> /class/net/http/session/sessionmanager.class.php
> >> 2007-02-05
> >> > 22:15:16 UTC (rev 4693)
> >> > @@ -104,7 +104,7 @@
> >> >                                 $scriptUrl = HttpVars::getBaseUrl();
> >> >
> >> >                         $url = new Url( $scriptUrl );
> >> > -                       $domain = str_replace( "www.", ".",
> >> > $url->getHost());
> >> > +                       $domain = preg_replace("/^www\./", ".",
> >> > $url->getHost());
> >> >
> >> >                         // this won't work for top level domains and
> >> > domains such as
> >> >                         // 'localhost' or internal domains for
> obvious
> >> > security reasons...
> >> >
> >> > _______________________________________________
> >> > pLog-svn mailing list
> >> > pLog-svn at devel.lifetype.net
> >> > http://limedaley.com/mailman/listinfo/plog-svn
> >> >
> >>
> >>
> >
>
> --
> Jon Daley
> http://jon.limedaley.com/
>
> I have never met a man so ignorant that
> I couldn't learn something from him.
> -- Galileo Galilei
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://limedaley.com/pipermail/plog-svn/attachments/20070207/a26c0474/attachment.htm 


More information about the pLog-svn mailing list