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

Re: character-by-character in a huge file

by hardburn (Abbot)
on Apr 08, 2004 at 17:43 UTC ( [id://343679]=note: print w/replies, xml ) Need Help??


in reply to character-by-character in a huge file

Try writing a quick program that reads the file in whatever way your main program does. Just read it in and nothing else. Keep track of the run time. Then compare it to the runtime of the real program. I bet there isn't a great deal of difference. The reason is that simply reading 3GB of data using any method is going to be quite slow.

----
: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: character-by-character in a huge file
by Anomynous Monk (Scribe) on Apr 08, 2004 at 18:00 UTC
    I have to disagree; that code will execute about 14 ops per character (or about 42000000000 ops total); even the overhead of perl's op dispatch loop will be huge, much less the actual code of the ops themselves. Simulating just the basic overhead with perl -we'1 for 1..14000000000' (3 ops per loop iteration) runs about 36 minutes on my system; this is substantially longer than it would take to read through 3Gb.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://343679]
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: (2)
As of 2024-04-25 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found