I get this (perl v5.26.2):

s/iter interp Eily OFS interp 2.98 -- -5% -7% Eily 2.83 5% -- -2% OFS 2.77 8% 2% --

my @big = (rand () x $size); What do you expect @big to contain after this though? It looks like you wanted to make an array of random numbers. But rand is only called once so you just have one repeated value. Also x is tricky (I'd even say un-perl-like) because it depends on the operands in a way that no other operator in perl does. So the first thing I did was check how many elements are in @big: 1, with 50 000 000 copies of the random value. This means that you are just writing one item and neither the for loop nor the use of $, have much of an effect (if at all) here. So finding a significant difference between Eily and OFS would have been worrying.


In reply to Re^6: Write large array to file, very slow by Eily
in thread Write large array to file, very slow by junebob

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.