my $t1 = timeit(1_000_000, \&odd_1); my $t2 = timeit(1_000_000, \&odd_2); print "odd_1: ",timestr($t1),"\n"; print "odd_2: ",timestr($t2),"\n"; sub odd_1 { my $num = rand(2**31); return $num % 2; } sub odd_2 { my $num = rand(2**31); return $num & 1; } #### [falkkin@shadow ~/perl] perl odd.pl odd_1: 6 wallclock secs ( 6.29 usr + -0.00 sys = 6.29 CPU) @ 158982.51/s (n=1000000) odd_2: 10 wallclock secs ( 9.36 usr + -0.01 sys = 9.35 CPU) @ 106951.87/s (n=1000000)