#PrintIText() = SLOW?
5 messages in this thread
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
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.
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.
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
It's almost certain that it is NOT PrintIText() which is causing your problems.
The console is substantially slower.
Victor A. Wagner, Jr.