I assume you're referring to the runtime check for symbolic references, as that is the only run-time component for stricture?
$ perl -MO=Deparse -e '{use strict; my $a = 1}' { use strict 'refs'; my $a = 1; }
Well, I've taken the liberty of benchmarking the use of strict refs, and I must say it's a meager optimization indeed. I ran this code on a (new) completely unloaded machine: it would seem to me that the difference is noticable, but seems to be drowned out by noise almost completely.
use Benchmark qw(:all); cmpthese( 10000000, { with => sub {use strict 'refs'; my $a = 1; my $b = 2}, without => sub {my $a = 1; my $b = 2}, } ); __END__ Rate with without with 3378378/s -- -7% without 3623188/s 7% -- Rate without with without 3802281/s -- -3% with 3937008/s 4% -- Rate with without with 3412969/s -- -15% without 4032258/s 18% -- Rate with without with 4048583/s -- -3% without 4166667/s 3% -- Rate with without with 3460208/s -- -9% without 3787879/s 9% --
It would seem to me that if you need this type of optimization, you'd better start coding parts of your program in C ;-). So I wouldn't remove "use strict" from a production script for this reason: the likelyhood of a "quick hack" in the future on that production script messing up things without warning, would be just too great for me, from a sysadmin point of view.
Liz
In reply to Re: Re: to strict or not to strict
by liz
in thread to strict or not to strict
by castaway
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |