Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Benchmark: Constant List in Hash Slice

by tobyink (Canon)
on Mar 13, 2019 at 14:18 UTC ( [id://1231227]=note: print w/replies, xml ) Need Help??


in reply to Benchmark: Constant List in Hash Slice

Although use constant LIST=>(@keys) defines a list constant, Perl doesn't currently optimize this like it does with scalar constants. So every time you use the constant, it performs a sub call. That's why it's slower.

Update: it seems my knowledge was out of date. I've just checked and it turns out they were optimized in Perl 5.20. I'm guessing they weren't optimized quite as well as scalar constants though.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-20 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found