Newsgroups: comp.sys.amiga.programmer
Path: utzoo!utgpu!watserv1!watdragon!rose!ccplumb
From: ccplumb@rose.uwaterloo.ca (Colin Plumb)
Subject: Re: NorthC and BYTE sieve demo
Message-ID: <1991Feb24.041825.428@watdragon.waterloo.edu>
Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes)
Organization: University of Waterloo
References: <45620@nigel.ee.udel.edu>
Date: Sun, 24 Feb 1991 04:18:25 GMT
Lines: 24

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.
-- 
	-Colin
