From: Vincent Pit Date: Sat, 19 Jun 2010 14:58:10 +0000 (+0200) Subject: Bench several levels of dereferenciation X-Git-Tag: rt62800~13 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fautovivification.git;a=commitdiff_plain;h=3155da47060f2857adc99346d5803837d8ee0376 Bench several levels of dereferenciation --- diff --git a/samples/bench.pl b/samples/bench.pl index bb55856..9b0f173 100644 --- a/samples/bench.pl +++ b/samples/bench.pl @@ -5,6 +5,8 @@ use warnings; use Benchmark qw/cmpthese/; +use blib; + my $count = -1; { @@ -46,3 +48,12 @@ my $count = -1; fetch_hashref_nonexisting_noav => sub { no autovivification; $x->{a} }, }; } + +{ + my $x = { a => { b => { c => { d => 1 } } } }; + + cmpthese $count, { + fetch_hashref4_existing_av => sub { $x->{a}{b}{c}{d} }, + fetch_hashref4_existing_noav => sub { no autovivification; $x->{a}{b}{c}{d} }, + }; +}