XP is just a number | |
PerlMonks |
Re^4: Does "preallocating hash improve performance"? Or "using a hash slice"?by ikegami (Patriarch) |
on Feb 23, 2017 at 01:37 UTC ( [id://1182573]=note: print w/replies, xml ) | Need Help?? |
On second thought, a fresh hash is created on scope exit because a reference to the hash is returned.
So all we have is a test that shows that @h{ @array } = @array; is faster than $h{ $_ } = $_ for @array;, but doesn't conclusively show any benefit from pre-allocating.
In Section
Seekers of Perl Wisdom
|
|