Flat ASCII File Data Access

mcdonald at uxe.cso.uiuc.edu mcdonald at uxe.cso.uiuc.edu
Tue Jan 24 00:57:00 AEST 1989


>                                                  ... I have rammed into
>a wall in trying to access a flat ascii data file with 14,000 records in
>it.  Naturally, I could read the file one record at a time, but the 
>end user would probably expire due to old age if I wrote this program
>in that manner.


>I am not familiar with any of the "Ctree" type file managers, but I did
>have a similar problem on a UNIX system.  We had a file full of 4 byte records

>My solution?  Buffer the stuff up.  Instead of reading 4 bytes at a time,
>I read 512 bytes (128 records) at a time.  This reduced the number of disk
>accesses/syscalls from roughly 4000 per record to 30.  Runtime is now
>15 minutes (good conditions) to 45 minutes (bad conditions).  

I have tried this sort of stuff of MS-DOS, and it doesn't seem to 
do much good. Has anyone else gotten improvements this way? What
DOES do some good is to get a good disk cache program. I think the
previous two included paragraphs may only apply to (certain)
multitasking OS's.

Doug McDonald



More information about the Comp.lang.c mailing list