NYCPHP Meetup

NYPHP.org

[nycphp-talk] testing a theory

Adrian Noland anoland at indigente.net
Wed Feb 7 14:43:55 EST 2007


On 2/7/07, Adrian Noland <anoland at indigente.net> wrote:
> The loop is optimizing the results. Here is what I got when I replaced
> them with 115K direct strings.
>
> Without profiling
> Concatenation took 4.47135686874. Multiple echoes took 5.18587899208.
> Concatenation took 4.42481684685. Multiple echoes took 5.15758609772.
> Concatenation took 4.42998504639. Multiple echoes took 5.14059782028.
>
> with profiling enabled:
> Concatenation took 7.02670788765. Multiple echoes took 7.44358682632
> http://indigente.net/profile_microtime.profile.txt (7MB file)
> http://indigente.net/profile_microtime.php.txt (10MB)
>
> Obviously, I don't have any 10MB PHP files and this isn't a real world
> example, but it is somewhat enlightening. I'm interested in
> everybody's thoughts on this.
>

Responding to my own post...
I realized that rand() may be exaggerating again, so I ran Rob's test
again with rand() added to the output and got these for comparison.
Concatenation took 1.42593598366. Multiple echoes took 1.53872704506
Concatenation took 1.75097298622. Multiple echoes took 1.98070502281
Concatenation took 1.66252112389. Multiple echoes took 1.82230710983

I guess the answer is going to be "It depends" on what you are doing.



More information about the talk mailing list