Re: performance improvements for 1.3

Benjamin Kram <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
> By in-line concatenation, you mean "foo" . "bar"?  I seem to remember
> reading once that that was relatively inefficient as it was constantly
> reallocating memory to hold the result.
> 
> I can try and find a cite if that's helpful.

It isn't efficient to do 
 "string1" . "string2" . "string3" . "stringN"
Perl will, (in order of expression evaluation) allocate a new string to hold two of them, copy them to the new memory, then repeat this for the new string and the leftover string.  As you can see, as N gets high, you're doing a -lot- of memory and copy work.

That's what join() is for...

cheers,
b

-- 
"it would be horrid to be robbed
 by the wrong kind of people"
			 -archy
			 Don Marquis, "the big bad wolf", 1935 


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.