optimilize web page loading

This is a discussion on optimilize web page loading within the PHP General forums, part of the PHP Programming Forums category; On Thu, Mar 27, 2008 at 7:28 AM, Al <news@ridersite.org> wrote: > Depends on the ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 03-27-2008
jeffry s
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

On Thu, Mar 27, 2008 at 7:28 AM, Al <news@ridersite.org> wrote:

> Depends on the server and it's load. I've strung together some rather
> large html strings and they
> aways take far less time than the transient time on the internet. I used
> to use OB extensively until
> one day I took the time to measure the difference. I don't recall the
> numbers; but, I do recall it
> was not worth the slight extra trouble to use OB.
>
> Now, I simple assemble by html strings with $report .= "foo"; And then
> echo $report at the end. It
> also makes the code very easy to read and follow.
>
> Andrew Ballard wrote:
> > On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
> >> You are really asking an HTML question, if you think about it.
> >>
> >> At the PHP level, either use output buffering or assemble all your

> html string as a variable and
> >> then echo it. The goal is to compress the string into the minimum

> number of packets.
> >
> > Yes, but do so smartly. Excessive string concatenation can slow things
> > down as well. On most pages you probably won't notice much difference,
> > but I have seen instances where the difference was painfully obvious.
> >
> > Andrew

>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


I am also doing the same way. assemble the string and echo it at the end

Reply With Quote
  #12 (permalink)  
Old 03-27-2008
Philip Thompson
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

On Mar 26, 2008, at 6:28 PM, Al wrote:
> Depends on the server and it's load. I've strung together some
> rather large html strings and they aways take far less time than the
> transient time on the internet. I used to use OB extensively until
> one day I took the time to measure the difference. I don't recall
> the numbers; but, I do recall it was not worth the slight extra
> trouble to use OB.
>
> Now, I simple assemble by html strings with $report .= "foo"; And
> then echo $report at the end. It also makes the code very easy to
> read and follow.


You might as well take it a step further. Change the above to:

$report .= 'foo';

This way for literal strings, the PHP parser doesn't have to evaluate
this string to determine if anything needs to be translated (e.g.,
$report .= "I like to $foo"). A minimal speedup, but nonetheless...

~Philip


> Andrew Ballard wrote:
>> On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
>>> You are really asking an HTML question, if you think about it.
>>>
>>> At the PHP level, either use output buffering or assemble all your
>>> html string as a variable and
>>> then echo it. The goal is to compress the string into the minimum
>>> number of packets.

>> Yes, but do so smartly. Excessive string concatenation can slow
>> things
>> down as well. On most pages you probably won't notice much
>> difference,
>> but I have seen instances where the difference was painfully obvious.
>> Andrew

Reply With Quote
  #13 (permalink)  
Old 03-27-2008
Al
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

Good point. I usually do use the single quotes, just happened to key doubles for the email.

Actually, it's good idea for all variable assignments.

Philip Thompson wrote:
> On Mar 26, 2008, at 6:28 PM, Al wrote:
>> Depends on the server and it's load. I've strung together some rather
>> large html strings and they aways take far less time than the
>> transient time on the internet. I used to use OB extensively until one
>> day I took the time to measure the difference. I don't recall the
>> numbers; but, I do recall it was not worth the slight extra trouble to
>> use OB.
>>
>> Now, I simple assemble by html strings with $report .= "foo"; And then
>> echo $report at the end. It also makes the code very easy to read and
>> follow.

>
> You might as well take it a step further. Change the above to:
>
> $report .= 'foo';
>
> This way for literal strings, the PHP parser doesn't have to evaluate
> this string to determine if anything needs to be translated (e.g.,
> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
>
> ~Philip
>
>
>> Andrew Ballard wrote:
>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
>>>> You are really asking an HTML question, if you think about it.
>>>>
>>>> At the PHP level, either use output buffering or assemble all your
>>>> html string as a variable and
>>>> then echo it. The goal is to compress the string into the minimum
>>>> number of packets.
>>> Yes, but do so smartly. Excessive string concatenation can slow things
>>> down as well. On most pages you probably won't notice much difference,
>>> but I have seen instances where the difference was painfully obvious.
>>> Andrew

Reply With Quote
  #14 (permalink)  
Old 03-27-2008
Shawn McKenzie
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

Al wrote:
> Good point. I usually do use the single quotes, just happened to key
> doubles for the email.
>
> Actually, it's good idea for all variable assignments.
>
> Philip Thompson wrote:
>> On Mar 26, 2008, at 6:28 PM, Al wrote:
>>> Depends on the server and it's load. I've strung together some
>>> rather large html strings and they aways take far less time than the
>>> transient time on the internet. I used to use OB extensively until
>>> one day I took the time to measure the difference. I don't recall the
>>> numbers; but, I do recall it was not worth the slight extra trouble
>>> to use OB.
>>>
>>> Now, I simple assemble by html strings with $report .= "foo"; And
>>> then echo $report at the end. It also makes the code very easy to
>>> read and follow.

>>
>> You might as well take it a step further. Change the above to:
>>
>> $report .= 'foo';
>>
>> This way for literal strings, the PHP parser doesn't have to evaluate
>> this string to determine if anything needs to be translated (e.g.,
>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
>>
>> ~Philip
>>
>>
>>> Andrew Ballard wrote:
>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
>>>>> You are really asking an HTML question, if you think about it.
>>>>>
>>>>> At the PHP level, either use output buffering or assemble all your
>>>>> html string as a variable and
>>>>> then echo it. The goal is to compress the string into the minimum
>>>>> number of packets.
>>>> Yes, but do so smartly. Excessive string concatenation can slow things
>>>> down as well. On most pages you probably won't notice much difference,
>>>> but I have seen instances where the difference was painfully obvious.
>>>> Andrew


Yes and if your script takes .00000000000000000000000000000002 seconds
to run using double quotes it will only take
..000000000000000000000000000000019 seconds with single (depending upon
how many quotes you have of course) :-)

-Shawn
Reply With Quote
  #15 (permalink)  
Old 03-27-2008
Jason Pruim
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading


On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
> Al wrote:
>> Good point. I usually do use the single quotes, just happened to key
>> doubles for the email.
>>
>> Actually, it's good idea for all variable assignments.
>>
>> Philip Thompson wrote:
>>> On Mar 26, 2008, at 6:28 PM, Al wrote:
>>>> Depends on the server and it's load. I've strung together some
>>>> rather large html strings and they aways take far less time than
>>>> the
>>>> transient time on the internet. I used to use OB extensively until
>>>> one day I took the time to measure the difference. I don't recall
>>>> the
>>>> numbers; but, I do recall it was not worth the slight extra trouble
>>>> to use OB.
>>>>
>>>> Now, I simple assemble by html strings with $report .= "foo"; And
>>>> then echo $report at the end. It also makes the code very easy to
>>>> read and follow.
>>>
>>> You might as well take it a step further. Change the above to:
>>>
>>> $report .= 'foo';
>>>
>>> This way for literal strings, the PHP parser doesn't have to
>>> evaluate
>>> this string to determine if anything needs to be translated (e.g.,
>>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
>>>
>>> ~Philip
>>>
>>>
>>>> Andrew Ballard wrote:
>>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
>>>>>> You are really asking an HTML question, if you think about it.
>>>>>>
>>>>>> At the PHP level, either use output buffering or assemble all
>>>>>> your
>>>>>> html string as a variable and
>>>>>> then echo it. The goal is to compress the string into the
>>>>>> minimum
>>>>>> number of packets.
>>>>> Yes, but do so smartly. Excessive string concatenation can slow
>>>>> things
>>>>> down as well. On most pages you probably won't notice much
>>>>> difference,
>>>>> but I have seen instances where the difference was painfully
>>>>> obvious.
>>>>> Andrew

>
> Yes and if your script takes .00000000000000000000000000000002 seconds
> to run using double quotes it will only take
> .000000000000000000000000000000019 seconds with single (depending upon
> how many quotes you have of course) :-)


I'm coming in late to this thread so sorry if I missed this :)

How much of a difference would it make if you have something like
this: echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar
bar bar bar" . $foo $foo; ?In other words... You have a large
application which is most likely to be faster? :)


>
>
> -Shawn
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim@raoset.com



Reply With Quote
  #16 (permalink)  
Old 03-27-2008
Shawn McKenzie
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

Jason Pruim wrote:
>
> On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
>> Al wrote:
>>> Good point. I usually do use the single quotes, just happened to key
>>> doubles for the email.
>>>
>>> Actually, it's good idea for all variable assignments.
>>>
>>> Philip Thompson wrote:
>>>> On Mar 26, 2008, at 6:28 PM, Al wrote:
>>>>> Depends on the server and it's load. I've strung together some
>>>>> rather large html strings and they aways take far less time than the
>>>>> transient time on the internet. I used to use OB extensively until
>>>>> one day I took the time to measure the difference. I don't recall the
>>>>> numbers; but, I do recall it was not worth the slight extra trouble
>>>>> to use OB.
>>>>>
>>>>> Now, I simple assemble by html strings with $report .= "foo"; And
>>>>> then echo $report at the end. It also makes the code very easy to
>>>>> read and follow.
>>>>
>>>> You might as well take it a step further. Change the above to:
>>>>
>>>> $report .= 'foo';
>>>>
>>>> This way for literal strings, the PHP parser doesn't have to evaluate
>>>> this string to determine if anything needs to be translated (e.g.,
>>>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
>>>>
>>>> ~Philip
>>>>
>>>>
>>>>> Andrew Ballard wrote:
>>>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
>>>>>>> You are really asking an HTML question, if you think about it.
>>>>>>>
>>>>>>> At the PHP level, either use output buffering or assemble all your
>>>>>>> html string as a variable and
>>>>>>> then echo it. The goal is to compress the string into the minimum
>>>>>>> number of packets.
>>>>>> Yes, but do so smartly. Excessive string concatenation can slow
>>>>>> things
>>>>>> down as well. On most pages you probably won't notice much
>>>>>> difference,
>>>>>> but I have seen instances where the difference was painfully obvious.
>>>>>> Andrew

>>
>> Yes and if your script takes .00000000000000000000000000000002 seconds
>> to run using double quotes it will only take
>> .000000000000000000000000000000019 seconds with single (depending upon
>> how many quotes you have of course) :-)

>
> I'm coming in late to this thread so sorry if I missed this :)
>
> How much of a difference would it make if you have something like this:
> echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar bar bar
> bar" . $foo $foo; ?In other words... You have a large application which
> is most likely to be faster? :)
>
>
>>
>>
>> -Shawn
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424-9337
> www.raoset.com
> japruim@raoset.com
>
>
>

I would assume your 2 examples to be the same because the point is that
the PHP interpreter must parse for vars to substitute when it encounters
double-quotes whether there are any vars in it or not. With
single-quotes the interpreter does not have to worry about it.
Regardless, the speed diff is probably negligible, hence my flame
inviting post. :-)

-Shawn
Reply With Quote
  #17 (permalink)  
Old 03-27-2008
Shawn McKenzie
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

Shawn McKenzie wrote:
> Jason Pruim wrote:
>> On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
>>> Al wrote:
>>>> Good point. I usually do use the single quotes, just happened to key
>>>> doubles for the email.
>>>>
>>>> Actually, it's good idea for all variable assignments.
>>>>
>>>> Philip Thompson wrote:
>>>>> On Mar 26, 2008, at 6:28 PM, Al wrote:
>>>>>> Depends on the server and it's load. I've strung together some
>>>>>> rather large html strings and they aways take far less time than the
>>>>>> transient time on the internet. I used to use OB extensively until
>>>>>> one day I took the time to measure the difference. I don't recall the
>>>>>> numbers; but, I do recall it was not worth the slight extra trouble
>>>>>> to use OB.
>>>>>>
>>>>>> Now, I simple assemble by html strings with $report .= "foo"; And
>>>>>> then echo $report at the end. It also makes the code very easy to
>>>>>> read and follow.
>>>>> You might as well take it a step further. Change the above to:
>>>>>
>>>>> $report .= 'foo';
>>>>>
>>>>> This way for literal strings, the PHP parser doesn't have to evaluate
>>>>> this string to determine if anything needs to be translated (e.g.,
>>>>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
>>>>>
>>>>> ~Philip
>>>>>
>>>>>
>>>>>> Andrew Ballard wrote:
>>>>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
>>>>>>>> You are really asking an HTML question, if you think about it.
>>>>>>>>
>>>>>>>> At the PHP level, either use output buffering or assemble all your
>>>>>>>> html string as a variable and
>>>>>>>> then echo it. The goal is to compress the string into the minimum
>>>>>>>> number of packets.
>>>>>>> Yes, but do so smartly. Excessive string concatenation can slow
>>>>>>> things
>>>>>>> down as well. On most pages you probably won't notice much
>>>>>>> difference,
>>>>>>> but I have seen instances where the difference was painfully obvious.
>>>>>>> Andrew
>>> Yes and if your script takes .00000000000000000000000000000002 seconds
>>> to run using double quotes it will only take
>>> .000000000000000000000000000000019 seconds with single (depending upon
>>> how many quotes you have of course) :-)

>> I'm coming in late to this thread so sorry if I missed this :)
>>
>> How much of a difference would it make if you have something like this:
>> echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar bar bar
>> bar" . $foo $foo; ?In other words... You have a large application which
>> is most likely to be faster? :)
>>
>>
>>>
>>> -Shawn
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>

>> --
>>
>> Jason Pruim
>> Raoset Inc.
>> Technology Manager
>> MQC Specialist
>> 3251 132nd ave
>> Holland, MI, 49424-9337
>> www.raoset.com
>> japruim@raoset.com
>>
>>
>>

> I would assume your 2 examples to be the same because the point is that
> the PHP interpreter must parse for vars to substitute when it encounters
> double-quotes whether there are any vars in it or not. With
> single-quotes the interpreter does not have to worry about it.
> Regardless, the speed diff is probably negligible, hence my flame
> inviting post. :-)
>
> -Shawn


Actually: echo $foo . "bar bar bar bar" . $foo $foo;
Should be: echo $foo . "bar bar bar bar" . $foo . " " . $foo;

So this would be 'slower' because there are 2 separate instances of
double-quotes for the interpreter to parse for vars.

-Shawn
Reply With Quote
  #18 (permalink)  
Old 03-27-2008
tedd
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

At 10:21 AM -0500 3/27/08, Shawn McKenzie wrote:
>
>I would assume your 2 examples to be the same because the point is that
>the PHP interpreter must parse for vars to substitute when it encounters
>double-quotes whether there are any vars in it or not. With
>single-quotes the interpreter does not have to worry about it.
>Regardless, the speed diff is probably negligible, hence my flame
>inviting post. :-)
>
>-Shawn


-Shawn:

The time difference is not the reason why I use single and double
quotes. I do it for two reasons: 1) It's good coding practice to know
what's happening in the background and consider it; 2) If I use a
single quote, then I know that statement does not contain a variable
-- it's a form of documentation for me.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote
  #19 (permalink)  
Old 03-27-2008
Peter Ford
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

Jason Pruim wrote:
>
> On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
>> Al wrote:
>>> Good point. I usually do use the single quotes, just happened to key
>>> doubles for the email.
>>>
>>> Actually, it's good idea for all variable assignments.
>>>
>>> Philip Thompson wrote:
>>>> On Mar 26, 2008, at 6:28 PM, Al wrote:
>>>>> Depends on the server and it's load. I've strung together some
>>>>> rather large html strings and they aways take far less time than the
>>>>> transient time on the internet. I used to use OB extensively until
>>>>> one day I took the time to measure the difference. I don't recall the
>>>>> numbers; but, I do recall it was not worth the slight extra trouble
>>>>> to use OB.
>>>>>
>>>>> Now, I simple assemble by html strings with $report .= "foo"; And
>>>>> then echo $report at the end. It also makes the code very easy to
>>>>> read and follow.
>>>>
>>>> You might as well take it a step further. Change the above to:
>>>>
>>>> $report .= 'foo';
>>>>
>>>> This way for literal strings, the PHP parser doesn't have to evaluate
>>>> this string to determine if anything needs to be translated (e.g.,
>>>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
>>>>
>>>> ~Philip
>>>>
>>>>
>>>>> Andrew Ballard wrote:
>>>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
>>>>>>> You are really asking an HTML question, if you think about it.
>>>>>>>
>>>>>>> At the PHP level, either use output buffering or assemble all your
>>>>>>> html string as a variable and
>>>>>>> then echo it. The goal is to compress the string into the minimum
>>>>>>> number of packets.
>>>>>> Yes, but do so smartly. Excessive string concatenation can slow
>>>>>> things
>>>>>> down as well. On most pages you probably won't notice much
>>>>>> difference,
>>>>>> but I have seen instances where the difference was painfully obvious.
>>>>>> Andrew

>>
>> Yes and if your script takes .00000000000000000000000000000002 seconds
>> to run using double quotes it will only take
>> .000000000000000000000000000000019 seconds with single (depending upon
>> how many quotes you have of course) :-)

>
> I'm coming in late to this thread so sorry if I missed this :)
>
> How much of a difference would it make if you have something like this:
> echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar bar bar
> bar" . $foo $foo; ?In other words... You have a large application which
> is most likely to be faster? :)
>
>


There was a discussion about this a few weeks ago - ISTR that the compiler does
wierd things with double-quoted strings, something like tokenising the words and
checking each bit for lurking variables.
So in fact

echo "$foo bar bar bar bar $foo $foo";

is slowest (because there *are* variables to interpolate,

echo $foo . " bar bar bar bar ".$foo." ".$foo;

is a bit faster, but the double-quoted bits cause some slow-down,

echo $foo . ' bar bar bar bar '.$foo.' '.$foo;

is a bit faster again - the single quoted bits pass through without further
inspection, and finally

echo $foo,' bar bar bar bar ',$foo,' ',$foo;

is actually the fastest, because the strings are not concatenated before output.

I think that was the overall summary - I can't locate the original post to
verify (or attribute) but it's in this list somewhere...

Cheers

--
Peter Ford phone: 01580 893333
Developer fax: 01580 893399
Justcroft International Ltd., Staplehurst, Kent
Reply With Quote
  #20 (permalink)  
Old 03-27-2008
Eric Butera
 
Posts: n/a
Default Re: [PHP] Re: optimilize web page loading

On Thu, Mar 27, 2008 at 12:41 PM, Peter Ford <pete@justcroft.com> wrote:
>
> Jason Pruim wrote:
> >
> > On Mar 27, 2008, at 11:05 AM, Shawn McKenzie wrote:
> >> Al wrote:
> >>> Good point. I usually do use the single quotes, just happened to key
> >>> doubles for the email.
> >>>
> >>> Actually, it's good idea for all variable assignments.
> >>>
> >>> Philip Thompson wrote:
> >>>> On Mar 26, 2008, at 6:28 PM, Al wrote:
> >>>>> Depends on the server and it's load. I've strung together some
> >>>>> rather large html strings and they aways take far less time than the
> >>>>> transient time on the internet. I used to use OB extensively until
> >>>>> one day I took the time to measure the difference. I don't recall the
> >>>>> numbers; but, I do recall it was not worth the slight extra trouble
> >>>>> to use OB.
> >>>>>
> >>>>> Now, I simple assemble by html strings with $report .= "foo"; And
> >>>>> then echo $report at the end. It also makes the code very easy to
> >>>>> read and follow.
> >>>>
> >>>> You might as well take it a step further. Change the above to:
> >>>>
> >>>> $report .= 'foo';
> >>>>
> >>>> This way for literal strings, the PHP parser doesn't have to evaluate
> >>>> this string to determine if anything needs to be translated (e.g.,
> >>>> $report .= "I like to $foo"). A minimal speedup, but nonetheless...
> >>>>
> >>>> ~Philip
> >>>>
> >>>>
> >>>>> Andrew Ballard wrote:
> >>>>>> On Wed, Mar 26, 2008 at 1:18 PM, Al <news@ridersite.org> wrote:
> >>>>>>> You are really asking an HTML question, if you think about it.
> >>>>>>>
> >>>>>>> At the PHP level, either use output buffering or assemble all your
> >>>>>>> html string as a variable and
> >>>>>>> then echo it. The goal is to compress the string into the minimum
> >>>>>>> number of packets.
> >>>>>> Yes, but do so smartly. Excessive string concatenation can slow
> >>>>>> things
> >>>>>> down as well. On most pages you probably won't notice much
> >>>>>> difference,
> >>>>>> but I have seen instances where the difference was painfully obvious.
> >>>>>> Andrew
> >>
> >> Yes and if your script takes .00000000000000000000000000000002 seconds
> >> to run using double quotes it will only take
> >> .000000000000000000000000000000019 seconds with single (depending upon
> >> how many quotes you have of course) :-)

> >
> > I'm coming in late to this thread so sorry if I missed this :)
> >
> > How much of a difference would it make if you have something like this:
> > echo "$foo bar bar bar bar $foo $foo"; verses: echo $foo . "bar bar bar
> > bar" . $foo $foo; ?In other words... You have a large application which
> > is most likely to be faster? :)
> >
> >

>
> There was a discussion about this a few weeks ago - ISTR that the compiler does
> wierd things with double-quoted strings, something like tokenising the words and
> checking each bit for lurking variables.
> So in fact
>
>
> echo "$foo bar bar bar bar $foo $foo";
>
> is slowest (because there *are* variables to interpolate,
>
>
> echo $foo . " bar bar bar bar ".$foo." ".$foo;
>
> is a bit faster, but the double-quoted bits cause some slow-down,
>
>
> echo $foo . ' bar bar bar bar '.$foo.' '.$foo;
>
> is a bit faster again - the single quoted bits pass through without further
> inspection, and finally
>
>
> echo $foo,' bar bar bar bar ',$foo,' ',$foo;
>
> is actually the fastest, because the strings are not concatenated before output.
>
> I think that was the overall summary - I can't locate the original post to
> verify (or attribute) but it's in this list somewhere...
>
> Cheers
>
> --
> Peter Ford phone: 01580 893333
> Developer fax: 01580 893399
> Justcroft International Ltd., Staplehurst, Kent
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Can you prove these statements with real benchmarks that are current?
Ilia said that it is a myth that there is a performance difference
between " and ' in one of his talks.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:17 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0