Re: & performance issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 17, 2008 at 7:10 PM, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
> On Thu, Apr 17, 2008 at 11:51 AM, Eric Butera <eric.butera@xxxxxxxxx> wrote:
>
> >
> >
> >
> > On Thu, Apr 17, 2008 at 12:00 PM, Nathan Nobbe <quickshiftin@xxxxxxxxx>
> wrote:
> > > On Thu, Apr 17, 2008 at 4:57 AM, Bojan Tesanovic <btesanovic@xxxxxxxxx>
> > >  wrote:
> > >
> > >
> > >  > in PHP5 by default Objects are passed by reference and as you can see
> at
> > >  > this graph passing array by reference in PHP5 is slower
> > >  > http://nathan.moxune.com/arrayVsArrayIteratorReport.php
> > >
> > >
> > >  wow, thats hilarious, thats my own chart :O  ROTFL
> > >
> > >  im glad somebody else thought something of it ;)
> > >
> > >  -nathan
> > >
> >
> > I almost spit my water out when I saw that link directed at you.
>
> good times!
>
> >  Your
> > work is famous!  ;)
>
> well i do what i can :D
>
>
> > I don't have an actual answer as far as benchmarks go.  I've been
> > converting all of my sites from php4 to 5 over the past 3 months
> > stripping out &'s as I go.  I haven't noticed any differences myself
> > though.  But then again I've been adding in type hints and visibility
> > too so I'm sure that isn't helping.
>
> yea; i hadnt thought of the overhead of adding visibility / type hinting in.
> but if im adding those, either way; the extra cost from the & can be gained
> back if theyre yanked.
>
>
> > I'm always pimping Xdebug, so just remember it will show you where
> > your real bottlenecks are instead of guessing.  *shrug*
>
> xdebug is da bomb; thats what i used to build the charts from the
> performance report ;)
>
> ok, so heres what im thinking.  any functions that return by reference can
> safely be changed, right?  so i could do a mass replace like this
>
> find: 'function &'
> replace: 'function '
>
> note, there is a space after function in the replace.  i think the only
> reason to use return by reference is when returning an object to avoid
> getting a copy back in the php4 days.  the rest im thinking can be done by
> hand as time goes on.  waddya all think?
>
> thx,
>
> -nathan
>

Should be ok, but that is what unit tests are for, right?  ;)  I only
used return by reference when returning objects.  I think referencing
array inputs would be more of a challenge if there was any trickery
going on there.  The return value should just be a final here you go
since the function is done at that point.  Guess you'll find out when
you try it.  Just make a backup first! :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux