Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Benchmark tips

by TheDamian (Priest)
on Apr 14, 2003 at 22:43 UTC ( #250434=note: print w/ replies, xml ) Need Help??


in reply to Benchmark tips
in thread Making a match

WRT suggestion 1: just thought I should mention that I was, of course, far too Lazy to actually align them myself:

use List::Util 'max'; sub align { my ($hash) = @_; my $len = max map length, keys %$hash; $hash->{sprintf "%${len}s", $_} = delete $hash->{$_} for keys %$hash; return $hash; } cmpthese(10000, align { 'Bacon, Lettuce, & Tomato' => sub {...}, 'Ham on Rye' => sub {...}, 'Spam' => sub {...}, # etc. });


Comment on Re: Benchmark tips
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-08-20 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (122 votes), past polls