Re: performance improvements for 1.3
Dave Rolsky <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 27 Sep 2004, Benjamin Kram wrote: > > 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... It'd be more efficient that what we do now. Using join() would be very difficult, since we may have other Perl code between <% %> tags. -dave /*=========================== VegGuide.Org Your guide to all that's veg. ===========================*/ ------------------------------------------------------- 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