Re: [PEPr] +1 for XML::XML_Feed_Parser

From: Date: Fri, 21 Oct 2005 16:39:22 +0000
Subject: Re: [PEPr] +1 for XML::XML_Feed_Parser
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-40245@lists.php.net to get a copy of this message
On 10/20/05, Sean Coates <sean@caedmon.net> wrote: > Sorry to jump in... > > > JP> I would prefer using ' for all strings except those with > > JP> backslash expressions as variable interpolation is more expensive > > JP> and less visible than concatenation. > > Justin, are you sure? I always understood concatenation to be slower > because memory had to be allocated separately for each string (prior to > concatenation) whereas with interpolation, the memory is already > allocated. Not trying to start a fight--I actually want to know your > interpretation/proof. I wrote a small script a while back to test this and concatenation was a good bit faster than interpolation. And as you've heard from multiple other sources other people have come ot the same conclustion. The difference isn't great (or very reproducable) when using ' or " with non-interpolated strings, but since concatenation is faster than interpolation it's better to be consistent and use ' for everything possible. And, as Alan pointed out a while back it's easier to audit strings with ' because you know for sure that there are no vars in them. -- Justin Patrin

« previous php.pear.dev (#40245) next »