in reply to Re: bit by overhead
in thread bit by overhead

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?

Replies are listed 'Best First'.
Re^3: bit by overhead
by BrowserUk (Patriarch) on Jan 06, 2011 at 19:03 UTC

    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.

        True. But its size matches that shown by the OP.

Re^3: bit by overhead
by ikegami (Patriarch) on Jan 06, 2011 at 18:50 UTC

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