kd2bd@ka2qhd.UUCP (John Magliacane) (11/29/89)
I've had the "Super-C" compiler for the C64 for about a year now and really enjoy using it. The text editor is great. I recently wrote a real-time earth satellite tracking program using this compiler, and was pleased with the results, except with the fact that the printf() function is WAY TOO SLOW! BASIC is much faster with screen I/O. I was wondering if anyone else has noticed this, and if so, if they were able to "speed things up a bit". The real advantage of compiling is having fast executable code, and Super-C does this, except for screen I/O. (Please e-mail responses, as I don't always have access to this news group.) Thanks!! ....John A. Magliacane -- AMPR : KD2BD @ NN2Z (Neptune, NJ) UUCP : ucbvax!rutgers!petsd!tsdiag!ka2qhd!kd2bd "For every problem, there is one solution which is simple, neat and wrong." -- H.L. Mencken
erc@khijol.UUCP (Edwin R. Carp) (12/01/89)
In article <46@ka2qhd.UUCP> kd2bd@ka2qhd.UUCP (John Magliacane) writes: > >printf() function is WAY TOO SLOW! BASIC is much faster with screen I/O. > >I was wondering if anyone else has noticed this, and if so, if they were able >to "speed things up a bit". The real advantage of compiling is having Try either sprintf to a string, then puts, or you can always do the old conversion stuff, then strcat to your output string, then puts'ing it.
jgreco@csd4.csd.uwm.edu (Joe Greco) (12/05/89)
In comp.sys.cbm article <46@ka2qhd.UUCP>, kd2bd@ka2qhd.UUCP (John Magliacane) wrote: >I recently wrote a real-time earth satellite tracking program using this >compiler, and was pleased with the results, except with the fact that the >printf() function is WAY TOO SLOW! BASIC is much faster with screen I/O. > >I was wondering if anyone else has noticed this, and if so, if they were able >to "speed things up a bit". The real advantage of compiling is having >fast executable code, and Super-C does this, except for screen I/O. If you know anything about C, you'll realize that printf is a standard library function. Now, I have had nearly no experience with C on the Commodore (but years of Commodore experience) but I'll give you some advice I learned when learning C on our Unisys supermini here at UWM.... printf is an extremely flexible routine. It can handle almost all of your output needs. However, this means that it is also extremely complex and fairly long, code-wise. If you don't need all of the formatting and output conversions, use putc, puts, or putw. These routines operate a heck of a lot nearer to machine-level and will greatly increase speed. printf itself was originally written in C, and I believe it itself called these routines. Most modern C compilers have this and other library routines written in assembler for maximized speed, but it is possible that Super-C does not. In summary, try using lower level I/O routines. Save printf for those tasks for which it would be too difficult to write your own routine. By the way, if you can avoid printf entirely (without too much hassle), do so. It takes up lots of memory. -- jgreco@csd4.csd.uwm.edu Joe Greco at FidoNet 1:154/200 USnail: 9905 W Montana Ave PunterNet Node 30 or 31 West Allis, WI 53227-3329 "These aren't anybody's opinions." Voice: 414/321-6184 Data: 414/321-9287 (Happy Hacker's BBS)