use Benchmark 'cmpthese'; my %hash = ( key => 'value' ); cmpthese( -10, { with => sub {delete $INC{strict.pm}; use strict 'refs'; my $a = 1; my $b = 2}, without => sub {$hash{key} = delete $hash{key}; my $a = 1; my $b = 2}, } ); __END__ P:\test>P:\bin\perl.exe junk.pl8 Rate without with without 25587/s -- -79% with 121330/s 374% -- #### use Benchmark 'cmpthese'; my %hash = ( key => 'value' ); cmpthese( -3, { with => sub {delete $INC{'strict.pm'}; use strict 'refs'; my $a = 1; my $b = 2}, without => sub {$hash{key} = delete $hash{key}; my $a = 1; my $b = 2}, } ); __END__ P:\test>..\bin\perl.exe junk.pl8 Rate without with without 24308/s -- -82% with 136483/s 461% -- #### use Benchmark 'cmpthese'; my %hash = ( key => 'value' ); cmpthese( -3, { with => sub { delete $INC{strict.pm}; require 'strict.pm'; strict::import( 'refs' ); my $a = 1; my $b = 2 }, without => sub { $hash{key} = delete $hash{key}; my $a = 1; my $b = 2 }, } ); __END__ P:\test>P:\bin\perl.exe junk.pl8 Rate with without with 7281/s -- -71% without 24851/s 241% -- #### use Benchmark 'cmpthese'; my %hash = ( key => 'value' ); cmpthese( -3, { with => sub { delete $INC{'strict.pm'}; require 'strict.pm'; strict::import( 'refs' ); my $a = 1; my $b = 2 }, without => sub { $hash{key} = delete $hash{key}; my $a = 1; my $b = 2 }, } ); __END__ P:\test>..\bin\perl.exe junk.pl8 Rate with without with 137/s -- -99% without 24226/s 17576% -- #### use Benchmark 'cmpthese'; my %hash = ( key => 'value' ); cmpthese( -3, { with => q[ BEGIN{ delete $INC{strict.pm}; use strict 'refs' } my $a = 1; my $b = 2 ], without => q[ BEGIN{ $hash{key} = delete $hash{key} } my $a = 1; my $b = 2 ], } ); __END__ P:\test>P:\bin\perl.exe junk.pl8 Rate without with without 374581/s -- -0% with 375658/s 0% -- #### use Benchmark 'cmpthese'; my %hash = ( key => 'value' ); cmpthese( -10, { with => q[ BEGIN{ delete $INC{'strict.pm'}; use strict 'refs' } my $a = 1; my $b = 2 ], without => q[ BEGIN{ $hash{'key'} = delete $hash{key} } my $a = 1; my $b = 2 ], } ); __END__ P:\test>..\bin\perl.exe junk.pl8 Rate with without with 368780/s -- -2% without 375558/s 2% -- P:\test>..\bin\perl.exe junk.pl8 Rate with without with 371638/s -- -1% without 374367/s 1% --