develooper Front page | perl.beginners | Postings from December 2002

Re: file into memory

Thread Previous | Thread Next
From:
R. Joseph Newton
Date:
December 24, 2002 10:43
Subject:
Re: file into memory
Message ID:
3E08AB0D.743AF44C@efn.org
Hi Bob,

See below


> > would like to suck the whole file into memory and processing
> > each line from
> > there.
>

Bob Showalter wrote:

>
> I'm not sure what that accomplishes for you, but...

Really?  In that case, you may be vastly underestimating the cost of I/O on performance.  Bear in mind that memory has a responce time in the 10- ns range, while disk accesses range in the milliseconds, while your process goes into the wait queue.  There is every reason in the world to seek to bring in the maximum usable data with each access.

Remember: while your logical file pointer may remain fixed, patiently awaiting your next get, the system has moved on, served other users, and may have moved the physical RW head many tracks away.  I think it's a very good rule of thumb to stick to one I/O channel at a time, and to do no more processing during access than is absolutely necessary to ensure data integrity.

Thrashing does not make for good programming.

Joseph


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About