On Wed, 21 Apr 2004 13:46:29 -0600, Justin Robbs wrote:
[snip optimizing program]
I was just going on the theory of I could drive a semi to work or
a hybrid car, but since I only live 3/4 of a mile from work it
makes precious little difference to the environment. However, I
still feel like I am doing my part by not driving a giant fuel
guzzler.
Suppose the building of a hybrid car cause more pollution than
building a giant fuel guzzler. Then suppose the saved pollution during
the lifetime of the car is smaller than the extra pollution in
production.
(This is probably not the case, I'm just adapting your analogy to fit
what is often the case in the world of programming)
The same thinking applies here. I don't want to incur
a performance penalty when I can just code it efficiently from
the beginning.
Often programmer time is much more expensive than CPU time, (the
production vs use analogy), don't waste time micromanaging code unless
you _know_ that the performance of that particular piece of code is
critical.
Were I trying to fix a performance bottle neck
this would be a drop in the bucket? However, since this is all
new code, I might as well do it right from the beginning.
And Dan and CBFs suggestion of using a struct is great for making it
right from the beginning. It's certainly easier (and thus less likely
that you make an error) than manually initializing each and every
field.
Also the suggestion to paying attention to the algorithm before
micromanaging code is a good one, it doesn't help finding the pirfect
tire rubber mixture to make a car go faster if the problems ist that
the wheels are square.