Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^5: Remove Duplicates from Array

by mpeever (Friar)
on Nov 03, 2008 at 00:18 UTC ( [id://721001]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Remove Duplicates from Array
in thread Remove Duplicates from Array

Well, the Description for the module explicitly tells us two things:

  1. the functions are fairly trivial
  2. their efficiency is due to their implementation in C
All of the below functions are implementable in only a couple of lines of Perl code. Using the functions from this module however should give slightly better performance as everything is implemented in C. The pure-Perl implementation of these functions only serves as a fallback in case the C portions of this module couldn't be compiled on this machine.

I'm deducing from the description that the Perl implementations aren't really intended to be that efficient.

Replies are listed 'Best First'.
Re^6: Remove Duplicates from Array
by JadeNB (Chaplain) on Nov 03, 2008 at 15:22 UTC
    I agree with you, in the sense that I'm not surprised if the pure-Perl List::MoreUtils::uniq doesn't blow a naïve implementation out of the water, speed-wise; but, like dragonchild, I thought that at least by using these functions one should get handling for unusual arrays, such as those containing arrays references—and this code doesn't provide that (or, at least, doesn't do so any better than Justin's original implementation).

    UPDATE: A conversation with dragonchild showed that my meaning was a little unclear, so let me try again. I realise that the existing code does correctly return objects, rather than their stringified versions, but it seems to me that it could incorrectly confuse (say) the string "ARRAY(0x18045c0)" with an arrayref.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://721001]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-24 03:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found