Re: long echo statement performance question
| From: | Frank Stanovcak | Date: | Fri, 06 Feb 2009 20:09:12 +0000 |
| Subject: | Re: long echo statement performance question | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287853@lists.php.net to get a copy of this message | ||
"Stuart" <stuttle@gmail.com> wrote in message
news:a5f019de0902060932k1ccf2948ua42f3cfa336942c9@mail.gmail.com...
> 2009/2/6 Frank Stanovcak <blindspotpro@comcast.net>:
>>
>> "Richard Heyes" <richard@php.net> wrote in message
>>
>> news:af8726440902060918v6d2f1ee1ia3f8391898747b2@mail.gmail.com...
>>>> Wouldn't have thought so. But for readability, you may find this a
>>>> little easier instead:
>>>
>>> Slight correction:
>>>
>>> ?>
>>> <?=$var1?> blah <?=var2?>
>>> <?php
>>>
>>> --
>>> Richard Heyes
>>>
>>> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
>>> http://www.rgraph.org (Updated January 31st)
>>
>> Actually that's what I'm in the middle of undoing. The first revision
>> was
>> jumping in and out of PHP mode upwards of 60 times per page on the
>> shorter
>> pages. I've read a couple places that that can put a huge performace hit
>> on
>> things, so I was just trying to simplify the code a bit. Plus I don't
>> have
>> the fast tags, <?=, enabled *blush*
>
> They're called short tags, not fast tags. There is nothing faster
> about them beyond the typing effort required.
>
> This question, or rather variations of it, appear on this list at
> pretty regular intervals. A little while ago I wrote a script to test
> the speed of various output methods.
>
> http://stut.net/projects/phpspeed/?iterations=10000
>
> As you can see, the difference is so minimal that unless you're doing
> it hundreds of thousands of times per script it makes little
> difference how you do it.
>
> In short it's usually not worth optimising at this level since greater
> gains are certainly to be had by looking at your interaction with
> databases or other external resources.
>
> -Stuart
>
> --
> http://stut.net/
Thanks Stuart!
So for clarity's sake jumping into and out of PHP parsing mode to echo a var
isn't going to do as great a performance hit as these naysayers would have
me believe. Good. I like the color coding of my html in my editor that is
lost when I have to quote it to get it to echo/print properly!
Frank