go ahead... be a heretic | |
PerlMonks |
Re: Benchmark: Constant List in Hash Sliceby tobyink (Canon) |
on Mar 13, 2019 at 14:18 UTC ( [id://1231227]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|