Re: & performance issues
| From: | Nathan Nobbe | Date: | Thu, 17 Apr 2008 15:55:53 +0000 |
| Subject: | Re: & performance issues | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-273188@lists.php.net to get a copy of this message | ||
On Thu, Apr 17, 2008 at 12:14 AM, Robert Cummings <robert@interjinn.com>
wrote:
> If it's faster, it's faster so that would suggest a performance gain...
> but as many will tell you, and you most likely already know... is the
> gain worth the effort? BTW, rote replacement of references like that,
> may not be a good idea. There are times when you really do want a
> reference to an object... or maybe not... but you or someone else might
> have done it anyways ;)
>
im not sure if its worth the effort yet; thats sortof why im asking about it
on the list. obviously ill risk introduction bugs, which obviously, i dont
want to do... ill have to analyze the regression system as it stands. if
its decent, i might be able to use it as a benchmark utility and to test for
bugs after the mass conversion.
Contrast:
> <?php
>
> $b = new Foo();
> $a = &$b;
> $a = new Fee();
>
> ?>
>
> Versus:
> <?php
>
> $b = new Foo();
> $a = $b;
> $a new Fee();
>
> ?>
>
> In the first $b references the instance of Fee since $a is a reference.
> In the second, $b remains an instance of Foo when $a becomes and
> instance of Fee.
wow, thats a clever example. honestly, i dont think ive ever done that
before myself... but clearly that doesnt mean others havent in this
codebase. thanks for the insight.
-nathan