Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Benchmark tips

by TheDamian (Vicar)
on Apr 14, 2003 at 22:43 UTC ( [id://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. });