in reply to Re^3: promoting array to a hash
in thread promoting array to a hash

Adding this sub:
sub uniq_Roy { my %x; grep {!$x{$_}++} @_ }
I got these results
Rate uniq_Zaxo uniq_dragonchild uniq_BrowserUk + uniq_Roy uniq_Zaxo 167192/s -- -19% -27% + -47% uniq_dragonchild 205487/s 23% -- -11% + -35% uniq_BrowserUk 230383/s 38% 12% -- + -27% uniq_Roy 317586/s 90% 55% 38% + --

We're not really tightening our belts, it just feels that way because we're getting fatter.

Replies are listed 'Best First'.
Re^5: promoting array to a hash
by dragonchild (Archbishop) on Jun 14, 2004 at 01:35 UTC
    Excellent! Yours is faster and will DWIM with references. Good deal! :-)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Re^5: promoting array to a hash
by BrowserUk (Patriarch) on Jun 14, 2004 at 12:02 UTC

    Unfortunately, the benchmark you started with wasn't good. See Re^4: promoting array to a hash.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail