Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^6: Write large array to file, very slow

by Eily (Monsignor)
on Aug 21, 2018 at 08:29 UTC ( [id://1220763]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Write large array to file, very slow
in thread Write large array to file, very slow

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.

Replies are listed 'Best First'.
Re^7: Write large array to file, very slow
by hippo (Bishop) on Aug 21, 2018 at 08:52 UTC

    D'oh! One of these days I'm going to learn to check the output file instead of blithely assuming that the data is what I think it is. Thanks for the cluebat.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1220763]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-23 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found