On Wed, Apr 23, 2014 at 01:34:21PM +0200, demerphq wrote: > On 18 March 2014 13:46, H.Merijn Brand <h.m.brand@xs4all.nl> wrote: > > On Tue, 18 Mar 2014 13:15:11 +0100, demerphq <demerphq@gmail.com> wrote: > > > >> > The difference in parsing time between single and double quotes strings is > >> > infinitesimal > >> > >> IMO there is no point in worrying about these kind of things unless > >> the string is very long. > > > > And not even then. I benched it years ago on several machines, and all > > bench results are in line-noise margins and differ per architecture. > > IIRC all big-endian boxes I tried on had a <1% preference for double > > quotes whereas little-endian boxes prefered single quotes. > > Well no, when the string becomes long it starts being interesting to > not use a quoted string, or to use single quoted here docs. > > When I checked last Perl has non-linear and degrading performance > parsing strings. The longer the string the slower it gets. > > In practice unless the string is quite long (hundreds to thousands of > characters) it is not something you need to worry about at all. On the > other hand if you happen to be dealing with a case where you are > generating code with lots of long quoted strings you can see real > parsing performance gains by removing the strings. The double-quoted parsing code is very inefficient. It does a lot of checks for each char position in the string; I suspect we could speed it up tremendously by doing a strchr() or similar to skip to the next "interesting" char, and only then doing all the checks. -- It's not that I'm afraid to die, I just don't want to be there when it happens. -- Woody AllenThread Previous | Thread Next