CompuServe Thread

#PrintIText() = SLOW?

5 messages in this thread
#69489From: David OldisOct 13, 1989 4:40 AM
Ello again… I just finished a Directory-routine that uses a PropGadget to display the entries in a file. It works great except for one small problem… ITS TOO SLOW!!! Compared to other Directory Displaying routines that I see in everyday programs, minejust seems to creep along. So I was wondering if anybody could tell me if I should use the PrintIText() function (which I'm using) or try using the Console and access the window using Write() from dos.library. Thanks… David
#69490From: Khalid AldoseriOct 13, 1989 4:51 AM
David, PrintIText() is very slow. This is because it has a lot of work to do. I would suggest using Text() instead. The reason for that is that PrintIText() does the full setup before doing each 'line'. i.e. It has to SetAPen(), SetBPen(), SetDrMd(), etc. before actually outputting the text. Text(), on the other hand does none of those, so you would do them just one time before you start printing them out on the screen. In my experience, Text() has proven to be around 5-6 times faster than PrintIText() depending on how you write the code. The only thing you need to do with Text() is to do a SetAPen(), SetBPen(), SetDrMd() before anything. Then, just do a Move(rastport,leftedge,topedge); and Text(rastport,string,strlen(string)); This is normally very fast and effecient. (Beats the hell out of PrintIText() anyway. 😉 I hope this helped you. Khalid.
#69492From: Khalid AldoseriOct 13, 1989 5:01 AM
David, Forgot to ask whether you're using linked IntuiText structs. If so, then you're probably calling PrintIText() only once. With Text() you can't do that, so you would have to set up the call and print each string separately using a loop. But, again, the speedup is well worth it. You could also use a FastText() routine which I have here somewhere. You use this instead of Text() to get real speed! (grin) I use it this technique in Scripit's file requester. All in all, if you're looking for speed, it's better to use Text() since both PrintIText() and the DOS Write() commands end up calling Text() anyway! Khalid.
#69789From: Mike BerroOct 15, 1989 11:47 AM
David, Although PrintIText() is indeed slow, usually the disk access is the limiting factor. Do you mean that after you get all the names, your scrolling is slow? Then use Text(). Many programs (including mine) use a custom Text() routine (similar to FastFonts) to get a fast text display to allow real-time scrolling. Also note that more more colors yields slower display. —Mike
#69875From: Vic WagnerOct 15, 1989 10:10 PM
It's almost certain that it is NOT PrintIText() which is causing your problems. The console is substantially slower. Victor A. Wagner, Jr.