XP is just a number | |
PerlMonks |
Re: Returning lists vs arraysby BrowserUk (Patriarch) |
on Jan 20, 2003 at 17:01 UTC ( [id://228395]=note: print w/replies, xml ) | Need Help?? |
My thought on this is that, if the dictates of your application lend or require you to return a list, rather than a ref, try and return the list without building an array first, if it's sensible to do so. As a example, rather than
save allocating and building the intermediate lexical array and do
Or even,
Each of those steps shaves a few micro/milliseconds of the operation. Not a lot as and of itself, but at the heart of a 3d-graphic class, significant enough. Updated: Corrected a couple of typos. Thanks ihb. Examine what is said, not who speaks. The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.
In Section
Seekers of Perl Wisdom
|
|