A83: Re: why bother


[Prev][Next][Index][Thread]

A83: Re: why bother




> >optimize code for a PC?
> >Algorithms, yes, usually, if it doesn't make the code more
> >difficult.  But the actual code?  No.  Why bother, for a computer
> >running at several hundred megahertz?
> </snip>
>
> <sarcasm>
> - Who cares if its bloatware?
> - Who cares if it requires slow runtime libraries to execute
> - What does it matter, if maybe you need to utilize the cpu which
>    runs at several hundred megahertz
> - vb is BETTER than everything else because it doesn't make
>    coding 'difficult'
> </sarcasm>

You missed the point entirely, or perhaps I was unclear.  One book I read, I
believe it was Michael Abrash's Black Book of Graphics Programming (title
might not be right...it's at my house), discussed optimization a lot.  Now,
there is a time for optimization.  If it's graphics, it better be fast.  If
it's a game, it better be fast.  But there is a point where it doesn't
matter.  If everything had to be the absolute fastest it could, there would
be no compilers or high level languages.  Everything would be coded in
assembly language.  But, why does it matter if it takes something one
millisecond or three milliseconds to execute, if it only runs once?
Programs only have to be fast enough that the user does not perceive them as
being slow.  Saving that extra two milliseconds is not going to be noticed
by the user, so it's not worth spending an entire day speeding it up.

As an example, notice the VTI startup code to analyze ROM images.  I happen
to have quite a few on my computer, so it takes a few seconds to read them
all.  Now, I haven't looked at the code, but I am sure that it could be sped
up, at least somewhat.  Now, is that extra half second of my time worth
Rusty spending several hours recoding it, or writing an optimize assembly
language version?  No, of course not.  It would be much more worthwhile to
spend the time adding new features, etc.  This is what I am talking about.
By the same token, if an extra 40k to program size will save you hours of
time, does it really matter that much?

> >Why can Rusty write stuff in the 3 days that might take me a month(not
> >talking asm)?
>
> - my guesses are:
>     1) You are not too good at it (code)
>        or
>     2) Rusty is very good

 It's called experience.  Could you write a complete C compiler in three
days?  If you take the time to optimize everything when it doesn't matter,
then you won't get anything accomplished.  The VCL, for example.  Sure, it
adds 300k+ to your executable size, but if it saves you a months worth of
work, isn't it worth it?

> >Because writing heavily optimized code just because you can and writing
> >excellent programs is something completely different.
>
> <sarcasm>
> - it doesn't matter if the code is elegant
> - the things that make up a good program are:
>      shiny buttons
>      shiny buttons
>      shiny buttons
>      shiny buttons
>      a nice gui
> </sarcasm>

Very true.  But what are 99% of the users going to notice?  As long as the
program seems to run fast, looks good and has features people want, they
will like it.  They aren't going to notice that you could have shaved a
couple milliseconds off your list sorting routine.



References: