use Benchmark qw( cmpthese ); use constant ITERATIONS => 50_000_000; my $counter = 0; cmpthese( ITERATIONS, { and => sub { ++$counter & 1 }, mod => sub { ++$counter % 2 }, }, ); __END__ mod 4761905/s -- -29% and 6666667/s 40% -- Rate mod and mod 4366812/s -- -21% and 5524862/s 27% -- Rate mod and mod 5524862/s -- -10% and 6134969/s 11% -- Rate and mod and 6493506/s -- -29% mod 9107468/s 40% -- Rate and mod and 6250000/s -- -14% mod 7288630/s 17% --