in reply to bit by overhead

What caused those arrays to have that overhead in the first place? Are you populating them using push? Populate them using an assignment instead.

Replies are listed 'Best First'.
Re^2: bit by overhead
by ELISHEVA (Prior) on Jan 06, 2011 at 18:26 UTC

    To OP, you might find this helpful: Difference between this array assignment and push

    To ikegami - I'm a bit confused because it seems like you are saying the exact opposite in your reply at the bottom of that thread. There you argue that the difference between push and assignment should be negligible, but if there is a difference, assignment is faster, and push is more memory efficient.

    That was in 2007. Have your views changed? Has Perl changed? Is there further background information you could give that would help reconcile the post above with your reply on that thread?

      I'm also baffled by this:

      $x = ['20110106', map( rand( 1e5 ), 1..4 ), int( rand 1000 ) ];; print total_size $x;; 440 @x = @{ $x };; print total_size \@x;; 440

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        @$x has no extra allocated elements to remove.

      My post in that thread discusses the efficiency of building an array. It doesn't discuss the size of the resulting array.