Re: long echo statement performance question

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

 



"Stuart" <stuttle@xxxxxxxxx> wrote in message 
news:a5f019de0902060932k1ccf2948ua42f3cfa336942c9@xxxxxxxxxxxxxxxxx
> 2009/2/6 Frank Stanovcak <blindspotpro@xxxxxxxxxxx>:
>>
>> "Richard Heyes" <richard@xxxxxxx> wrote in message
>> news:af8726440902060918v6d2f1ee1ia3f8391898747b2@xxxxxxxxxxxxxxxxx
>>>> 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 



-- 
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