Flat ASCII File Data Access
Michael Paul Hunter
bagpiper at oxy.edu
Fri Jan 27 06:40:14 AEST 1989
In article <225800111 at uxe.cso.uiuc.edu> mcdonald at uxe.cso.uiuc.edu writes:
>
>> ... I have rammed into
>>a wall in trying to access a flat ascii data file with 14,000 records in
[stuff]
>>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
[stuff]
>Doug McDonald
Under ms-dos file buffering is already done for you. One
thing to try is to read a whole lot more then 512bytes (which is the size of
the file buffer I think) and see if you get any speed up. But, I don't
think that this will change the number of accesses since ms-dos just read
sizeof(buffer) number of chars each time (that is assuming seq access).
For random access, determining adjacency and reading a large number of adjacent
items would probably help if you could organize what you wanted to do to
just work with adjacent items (where a adjacent to b is true if a and b are read
on the same pass).
Mike
More information about the Comp.lang.c
mailing list