P is for Practical | |
PerlMonks |
Re: Better mousetrap (getting top N values from list X)by BrowserUk (Patriarch) |
on Feb 02, 2005 at 05:27 UTC ( [id://427155]=note: print w/replies, xml ) | Need Help?? |
As the benchmarks show, your algorithm, is a good one. With a few tweaks to the implementation it runs faster still:
If this is more than an intellectual exercise, and you can handle Inline::C, then the same algorithm C-ified really flies: Update: Correct the Inline::C implementation below to avoid calloc and allow me to free the temporary C array.
Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
In Section
Seekers of Perl Wisdom
|
|