http://www.perlmonks.org?node_id=1231258


in reply to Re^2: Benchmark: Constant List in Hash Slice
in thread Benchmark: Constant List in Hash Slice

does this also explain why using a normal @array variable is faster than a constant list?
No. That's because constant arrays are implemented as constant array refs. So
use constant foo qw(a b c); @a = $h{foo()}
is implemented roughly as
use constant foo [qw(a b c)]; @a = $h{@{foo()}}
And neither (as far as I'm aware) get the compile-time HEK treatment

Dave.

Replies are listed 'Best First'.
Re^4: Benchmark: Constant List in Hash Slice
by LanX (Archbishop) on Mar 14, 2019 at 15:33 UTC
    Oh that's good to know, thanks! :)

    Hence constant arrays won't help much for tuning performance.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice