C (15/207)

From:Volker Barthelmann
Date:02 Dec 99 at 03:18:31
Subject:Re: Optimizing (Was: Re: Getting desperate!)

From: Volker Barthelmann <volker@vb.franken.de>

On Wed, 1 Dec 1999, Nuno Trancoso wrote:

> > expect the output to appear without calling fflush) - replace printf(...)
> > by fprintf(stdout,...) and you should notice the difference.
>
> I would, if my knowledge of C allowed it :((

Just replace printf(" ") by fprintf(stdout," "), printf("X") by
fprintf(stdout,"X") and so on.

> > For programs which do real calculations I doubt that BlitzBasic can
>
> So what is my program doing? Pretending it does calcs???

Most of the time it's writing to the console.

> Maybe CA1D
> is not interresting to you but it is to some ppl. It's much more interresting
> than CA2D, better know as LIFE.

My comment wasn't intended to address the quality or importance of your
program, just the amount of time it spends with calculations compared to
IO etc. For every character you're displaying, only a few dozens of
machine instructions are spent in your calculations. However, putting the
character into a file-stream, sending it to dos, through the
console-handler and put the pixels on the screen using intuition, layers,
whatever is much more time-consuming.

Therefore, whether the code for your calculations is twice as fast doesn't
make a difference because virtually all the time is spend in IO.

That's all I wanted to say here. Sorry, if this was misunderstandable.

> p.s. If i compile with +ppc, it get even slower. Is that because of context
> switches between 68K/PPC from doing calcs on PPC and writing to console
> using 68K?

Yes.

Volker