go ahead... be a heretic | |
PerlMonks |
Re^6: Order of evaluation/interpolation of references (UPDATED)by BrowserUk (Patriarch) |
on Mar 08, 2012 at 02:16 UTC ( [id://958398]=note: print w/replies, xml ) | Need Help?? |
The problem with this pseudo-code:
is that it means that concat() copies both it arguments -- rather than a copy of the second being appended to the first -- otherwise it would modified the referenced var. Which means that here:
The deref'd value and the space are copied once to put them together, and then the whole thing is copied again in the second concat(). That is not an optimisation. If the sequences were:
Ie. concat() appends it second argument to its first (as in sv_catsv()) and new() return a copy of its argument (as in newSVsv()), the each part of the final string is only copied once (subject to the need for reallocs which will be unnecessary for two or three short strings because of allocation (alignment) minimums), and it would be more efficient. It would also prevent the bug from manifesting itself. Update: Maybe this will clarify things; or not:
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|