Path: utzoo!attcan!uunet!lll-winken!ames!ncar!tank!uxc!uxc.cso.uiuc.edu!uxg.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald From: mcdonald@uxe.cso.uiuc.edu Newsgroups: comp.lang.c Subject: Re: Flat ASCII File Data Access Message-ID: <225800111@uxe.cso.uiuc.edu> Date: 23 Jan 89 14:57:00 GMT References: <218@hotlips.UUCP> Lines: 23 Nf-ID: #R:hotlips.UUCP:218:uxe.cso.uiuc.edu:225800111:000:1044 Nf-From: uxe.cso.uiuc.edu!mcdonald Jan 23 08:57:00 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