NYCPHP Meetup

NYPHP.org

[nycphp-talk] new vs clone Performance

csnyder chsnyder at gmail.com
Tue Oct 7 12:44:37 EDT 2008


On Tue, Oct 7, 2008 at 12:35 PM, Hans Zaunere <lists at zaunere.com> wrote:
>
> Out of curiosity, I wanted to get some benchmarks on using the new operator
> vs cloning.  I wrote a simple script, attached, which is fun to play with.
> Upshot:  clone is faster if used correctly (and depending on the object's
> operations).  Also some interesting observations in the script itself, and
> I'm interested in hearing other's observations/experiences.
>

By faster, how much faster do you mean?

I never really thought of doing this kind of optimization, but it
would be pretty easy to re-pattern object creation _if it was
significantly faster_. The script ran out of memory on my Mac, what
kind of speedup are you seeing, Hans?

  chris.



More information about the talk mailing list