For anyone interested, I've been doing some basic benching. Two of the tests are self-explanitory. The "no_braces" test is the same as "circumfix", except that it has all but the mandatory bracing removed. Over the next couple days, I'll do more elaborate testing that can be repeated easily. In this case, after numerous runs, I can only suspect that the 'no_braces' is slower consistently because perhaps perl has to do extra work to decide how to proceed. This is only a guess though. I don't know nearly enough about the guts to know for sure.

Result:

Rate no_braces circumfix postderef no_braces 2.59/s -- -2% -7% circumfix 2.64/s 2% -- -5% postderef 2.78/s 7% 5% --

Benchmark code:

#!/usr/bin/perl use warnings; use strict; use feature 'postderef'; no warnings 'experimental::postderef'; use Benchmark qw(cmpthese timethese); my $count = 100000; cmpthese(1000, { 'circumfix' => \&circumfix, 'postderef' => \&postderef, 'no_braces' => \&no_braces, }); sub circumfix { my ($h, $a, @a); for (1..$count){ push @{$h->{$_}}, [$_]; } for my $k (keys %{$h}){ for (@{$h->{$k}}){ push @{$a}, $_ for @{$_}; } } push @a, $_ for @{$a}; } sub postderef { my ($h, $a, @a); for (1..$count){ push $h->{$_}->@*, [$_]; } for my $k (keys $h->%*){ for ($h->{$k}->@*){ push $a->@*, $_ for $_->@*; } } push @a, $_ for $a->@*; } sub no_braces { my ($h, $a, @a); for (1..$count){ push @{$h->{$_}}, [$_]; } for my $k (keys %$h){ for (@{$h->{$k}}){ push @$a, $_ for @$_; } } push @a, $_ for @$a; }

In reply to Re: Experimental features: autoderef vs postfix deref by stevieb
in thread Experimental features: autoderef vs postfix deref by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.