http://qs321.pair.com?node_id=578843


in reply to Warnings and Strict in Production/Performance

Warnings are strong indicators of errors. Do you know the cause of the warnings you have received? If the warnings you received reveal code that needs to be fixed, then you can show their worth.

Are your coworkers planning on altering core and 3rd party modules as well? Wouldn't it be simpler to make warnings die noisily? Something as simple as $SIG{__WARN__} = sub { die ... }; might satisfy them.

The performance hit of warnings is negligible, IIRC. Feel free to Benchmark them.

Update: The following demonstrates that 100,000 warnings checks did not slow down Perl at all.

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, });

outputs

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% --