Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!strath-cs!str-va!clcp16 From: clcp16@vaxa.strath.ac.uk ((Stewart C. Russell)) Newsgroups: comp.sys.amiga.programmer Subject: Re: NorthC and BYTE sieve demo Message-ID: <1991Feb27.103025.10323@vaxa.strath.ac.uk> Date: 27 Feb 91 10:30:25 GMT References: <45620@nigel.ee.udel.edu> <1991Feb24.041825.428@watdragon.waterloo.edu> Organization: Strathclyde University VAX Cluster Lines: 33 In article <1991Feb24.041825.428@watdragon.waterloo.edu>, ccplumb@rose.uwaterloo.ca (Colin Plumb) writes: > Dennis_Grant@cmr001.bitnet wrote: >> My conclusion: The printf was taking a LOT of time to execute. >> >> My question: Is this normal? Could a lowly XT really crank out 1600000 >>printfs faster than my Amiga, or is this a quirk of NorthC? (or did BYTE >>delete those printfs too?) Any ideas? > > Sorry, but the answer is yes. An IBM XT has a text screen... it generates > characters in hardware from a character and an attribute byte. The Amiga > finds the character in the font, clips, blits, etc. It can be done very fast > in PC-XT like cases (one bitplane, writing directly to screen, monospaced > font -> no clipping), where you remove the extra checks from the code, > but if you're printing to a console window on a 2-bitplane workbench screen, > you're doing a lot more work. > > Then, if your printf isn't that smart (remember, it scans the string > for % signs; puts() is faster), and uses putchar() for each character, > and putchar() isn't buffered, then you call the dos.library once per > character, which sends a packet to the console.device, which is not a > shining example of tense code, which calls the graphics.library, which > checks layers, then digs through the font, then queues the blit and > returns from the mess... it can become a real pig. ...coupled with the fact that NorthC's printf looks like it's coming straight down the line at 300 baud. A reasonable compiler, but the console IO is unacceptably slow. No problems with any other compiler (even ZC, which is also based on Sozobon C). Stewart C. Russell University of Strathclyde, Glasgow, Scotland Also at CIX: scruss (scruss@cix.compulink.co.uk)