Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Summing Up Array Elements By Group

by imrags (Monk)
on Jan 21, 2009 at 08:57 UTC ( [id://737780]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    Benchmark: timing 1000000 iterations of tin1, tin2, tin3...
          tin1:  1 wallclock secs ( 0.59 usr +  0.00 sys =  0.59 CPU) @ 16
    +86340.64/s (n=1000000)
    ...
    tin3  450450/s   -- -66% -73%
    tin2 1333333/s 196%   -- -21%
    tin1 1686341/s 274%  26%   --
    
  2. or download this
    $results = timethese(1000000,{
    tin1 => '$output[int($_/3)] += $arr[$_] for 0..@arr-1;',
    ...
    }
    '});
    Benchmark::cmpthese( $results );
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found