Xref: utzoo comp.sys.mac:34566 comp.sys.mac.programmer:7479 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!mcvax!kth!draken!tut!santra!kampi.hut.fi!jmunkki From: jmunkki@kampi.hut.fi (Juri Munkki) Newsgroups: comp.sys.mac,comp.sys.mac.programmer Subject: Re: Quickdraw efficiency question Message-ID: <23543@santra.UUCP> Date: 11 Jul 89 11:42:50 GMT References: <1681@neoucom.UUCP> Sender: news@santra.UUCP Reply-To: jmunkki@kampi.hut.fi (Juri Munkki) Organization: Helsinki University of Technology, Finland Lines: 40 In article <1681@neoucom.UUCP> sam@neoucom.UUCP (Scott A. Mason) writes: >Question: > >Which would be faster when drawing multiple characters to a window? > > 1) repeated calls to DrawChar > 2) building a string and calling DrawString. > >Intuitively, I would think that DrawString would be faster, but then again, >doesn't DrawString make repeated calls to DrawChar? BTW, I want to do this >for a terminal emulation program, and want maximum screen drawing speed. The answer is that calling DrawString is several times faster than calling DrawChar (six times faster when I tested this on a Mac+). There are several reasons for this. For every call to a text drawing routine, QuickDraw and the Font Manager will have to figure out where the font is (maybe even call the resource manager to read the font from a file). Finally, when the font is ready, QuickDraw starts drawing the actual text. The text is drawn one scan-line at a time. In addition to drawing the characters, the clipping regions have to be accumulated. When you call DrawChar, the regions are created for every character. When you call DrawText or DrawString, the regions are interpreted only once. Disclaimer: This article is based on educated guesses. I might be wrong. Maybe you should get the communications manager from Apple. They should know how to write a fast terminal. This would save you the trouble of writing YATE (Yet Another Terminal Emulator). A good VT100 emulator takes about 20 pages of C source code. Add another 10-15 pages for a scrollback buffer and copy/paste support. Add another 10 pages for a decent user interface with file save and maybe a dialog to change the terminal settings. (The pages are in Courier-7 and about 25% of the lines are comments.) _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ | Juri Munkki jmunkki@hut.fi jmunkki@fingate.bitnet I Want Ne | | Helsinki University of Technology Computing Centre My Own XT | ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^