Xref: utzoo comp.lang.c:28393 comp.lang.misc:4957 comp.sys.ibm.pc:49946 comp.sys.ibm.pc.programmer:1298 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think!snorkelwacker!spdcc!xylogics!transfer!lectroid!jjmhome!m2c!wpi!jhallen From: jhallen@wpi.wpi.edu (Joseph H Allen) Newsgroups: comp.lang.c,comp.lang.misc,comp.sys.ibm.pc,comp.sys.ibm.pc.programmer Subject: Re: questions about a backup program for the MS-DOS environment Keywords: copy Message-ID: <12578@wpi.wpi.edu> Date: 3 May 90 07:02:42 GMT References: <255@uecok.UUCP> <1990Apr25.125806.20450@druid.uucp> <12459@wpi.wpi.edu> <2484@dataio.Data-IO.COM> Reply-To: jhallen@wpi.wpi.edu (Joseph H Allen) Organization: Worcester Polytechnic Institute, Worcester ,MA Lines: 32 In article <2484@dataio.Data-IO.COM> bright@Data-IO.COM (Walter Bright) writes: >In article <12459@wpi.wpi.edu> jhallen@wpi.wpi.edu (Joseph H Allen) writes: > darcy@druid.UUCP (D'Arcy J.M. Cain) writes: >< dcrow@uecok (David Crow -- ECU Student) writes: ><<<(no wonder it's so slow :-) Try (in small or tiny model): >< [asm example deleted] >There is no point in going to asm to get high speed file copies. Since it >is inherently disk-bound, there is no sense (unless tiny code size is >the goal). Here's a C version that you'll find is as fast as any asm code >for files larger than a few bytes (the trick is to use large disk buffers): > [better C example deleted] I didn't use asm to get the code itself fast. The only reason I did it was so that you can use 64K buffers in small/tiny model. Now if only there was a farread and farwrite call... I guess you can just compile the program in large model to have this same effect (by habit I don't tend to use the large models). Interestingly, this aspect of the copy program is one place where I think DOS is sometimes faster than UNIX. I suspect that many UNIX versions of 'cp' use block-sized buffers. Doing so makes overly pessimistic assumptions about the amount of physical memory you're likely to get. Of course, since DOS doesn't buffer writes it often ends up being slower anyway (since it has to seek to the FAT so often). 'copy *.*' would be much, much faster if only DOS was just a wee bit smarter... -- jhallen@wpi.wpi.edu (130.215.24.1)