While this is of course true, you missed vr's point about hash slices. With @h{ @keys } = @values; perl could use the size of the keys list to preallocate the hash. I guess this would turn out to be a waste of space if most of the keys are duplicates, which would explain why apparently setting all the keys "at once" seems to still require several reallocations.


In reply to Re^2: Does "preallocating hash improve performance"? Or "using a hash slice"? by Eily
in thread Does "preallocating hash improve performance"? Or "using a hash slice"? by vr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":