Path: utzoo!attcan!uunet!lll-winken!ames!ucsd!orion.cf.uci.edu!oberon!oxy!bagpiper From: bagpiper@oxy.edu (Michael Paul Hunter) Newsgroups: comp.lang.c Subject: Re: Flat ASCII File Data Access Message-ID: <14212@tiger.oxy.edu> Date: 26 Jan 89 20:40:14 GMT References: <218@hotlips.UUCP> <225800111@uxe.cso.uiuc.edu> Organization: Occidental College, Los Angeles, CA 90041 Lines: 26 In article <225800111@uxe.cso.uiuc.edu> mcdonald@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