Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: net.micro.amiga Subject: Re: File random access times. Message-ID: <8608281956.AA19132@cory.Berkeley.EDU> Date: Thu, 28-Aug-86 15:56:50 EDT Article-I.D.: cory.8608281956.AA19132 Posted: Thu Aug 28 15:56:50 1986 Date-Received: Fri, 29-Aug-86 05:32:17 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: University of California at Berkeley Lines: 31 >Using the Manx compiler, version 3.20a, I did some timings on random >file accesses. Here are some of the interesting results: Interesting results. I would like to comment on your comment on buffered I/O speeds (and buffered I/O in general, this isn't a flame or anything). >it seems like if call >read() with character count of 1000 or so, unbuffered I/O is faster >(I guess in this case it becomes equivalent to doing your own buffering.) My comment is that buffered I/O is useful when you are reading a lot of junk in small segments. For instance, try reading 8K one character at a time. With unbuffered I/O, things go slowly. With buffered I/O, reading is an order of magnitude faster. Additionaly, if you are making small relative seeks, buffered I/O wins because most of the time the data is already in the buffer and it doesn't have to make a system call. There is another use for buffered I/O: Think of the situation where you are reading files and writing files on the same disk. If you use unbuffered I/O, the poor disk is continuously seeking between the track it's reading and the track it's writing (because the sector cache is NOT a track cache). However, if you use buffered I/O with, say, a 4K input buffer and a 32K output buffer, disk seeks are lessed and overall program speed increases by an order of magnitude. Finally, due to the bug in the RAM: disk, you always want to use buffered output when writing to RAM: files. If you write in smaller segments to the RAM: disk, an incredible amount of memory is wasted for some reason. -Matt