Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^6: XS: EXTEND/mPUSHiby BrowserUk (Patriarch) |
on Sep 27, 2011 at 07:21 UTC ( [id://928030]=note: print w/replies, xml ) | Need Help?? |
I've benchmarked that for some huge arrays in the past ... and not detected any advantage in passing by reference (with Inline::C). I'm guessing that you were populating the passed-by-reference Av with new SVs? This (rnd64i( int n, SV *avref ) (i for inplace--terrible name)), assumes a pre-populated (not just pre-sized) array of n scalars into which it then sets the values to be returned. The Perl code contrasts ARGV[0] calls for 1 million values each time, with the same for rand64() which returns them on the stack and assigns them to an array.
The result is rnd64i() is up to 100 times faster:
That's a saving worth having. 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
|
|