Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Hash reference searching

by kyle (Abbot)
on Dec 07, 2009 at 17:18 UTC ( [id://811563]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Benchmark qw( cmpthese );
    use List::Util qw( shuffle );
    ...
    ref_h   139/s   140%   117%     6%     --    -0%    -6%
    hash_r  140/s   141%   117%     6%     0%     --    -5%
    hash_h  147/s   155%   130%    12%     6%     6%     --
    
  2. or download this
    my @rand = ( map { int rand $range } 1 .. $ITERS )[0 .. $ITERS/2];
    my @hits = ( shuffle keys %HASH )[0 .. $ITERS/2];
    my @miss = ( grep { ! exists $HASH{$_} } 0 .. $range )[0 .. $ITERS/2];
    
  3. or download this
            Rate  ref_h hash_h  ref_r  ref_m hash_r hash_m
    ref_h  229/s     --   -10%   -13%   -18%   -22%   -30%
    ...
    ref_m  279/s    22%    10%     6%     --    -5%   -14%
    hash_r 295/s    29%    16%    12%     6%     --   -10%
    hash_m 326/s    42%    28%    24%    17%    11%     --
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-19 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found