[sf-perl] Sorting vs. hash

Bern fluxnet at gmail.com
Fri Mar 28 12:49:43 PDT 2008


hash will never be faster then nothing (at least me thinks)
you can benchmark them tho

On Fri, Mar 28, 2008 at 12:44 PM, Neil Heller <nheller at silcon.com> wrote:

>
> An interesting question came up.
>
> Suppose you have a large number (> 250k) of strings in an array.
> You wish to eliminate duplicates.
>
> Is it faster to sort the array and then iterate once through the list
> (writing selected ones to a new array) or write them all into a hash (at
> which time duplicates would be naturally eliminated)?
>
> Neil Heller
>
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20080328/26460eee/attachment.html 


More information about the SanFrancisco-pm mailing list