use strict; use warnings; use Benchmark qw( cmpthese ); my $passes = 100_000; my $tests = -10; sub with { use warnings; my $i = 0; $i = $i + 1 # Undefined check for 0..$passes; 1; } sub without { no warnings; my $i = 0; $i = $i + 1 # No undefined check for 0..$passes; 1; } cmpthese($tests, { with => \&with, without => \&without, }); #### Benchmark: running with, without, each for at least 10 CPU seconds... with: 10 wallclock secs (10.24 usr + 0.00 sys = 10.24 CPU) @ 20.40/s (n=209) without: 11 wallclock secs (10.40 usr + 0.01 sys = 10.41 CPU) @ 20.47/s (n=213) Rate with without with 20.4/s -- -0% without 20.5/s 0% --