in reply to Re^2: hash slice ? No thanks, I'm about to return...
in thread hash slice ? No thanks, I'm about to return...

You surprised me with this, but:
Rate return no ret return 4682554/s -- -30% no ret 6642457/s 42% --
Is what i got from:
use Benchmark qw( cmpthese ); my %hash = (1, 2, 4, 6, 43, 32, 5, 6, 6, 43, 3, 54, 5, 1); cmpthese(0, { 'return' => sub { return \%hash }, 'no ret' => sub { \%hash }, });

Replies are listed 'Best First'.
Re^4: hash slice ? No thanks, I'm about to return...
by Anonymous Monk on Feb 19, 2005 at 20:54 UTC
    Surprising but pointless. Even the "slow" explicit return runs at 4 million iterations per second. Don't waste your time trying to use this as a real optimization.