Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Benchmark: Constant List in Hash Slice

by LanX (Archbishop)
on Mar 14, 2019 at 08:03 UTC ( #1231254=note: print w/replies, xml ) Need Help??


in reply to Re: 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?

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

  • Comment on Re^2: Benchmark: Constant List in Hash Slice

Replies are listed 'Best First'.
Re^3: Benchmark: Constant List in Hash Slice
by dave_the_m (Monsignor) on Mar 14, 2019 at 11:01 UTC
    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.

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1231254]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2019-06-27 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (111 votes). Check out past polls.

    Notices?