View Single Post
Old 15-03-2008, 10:49   #4 (permalink)
Hunch
Grumpy old man
 
Hunch's Avatar
 
Join Date: Oct 2007
Location: North Japan
Posts: 1,398
Declaring variables as and when they are needed is more efficient, however these kinds of problems generally aren't as much of an issue these days. Back when I was first started programming, machines had between about 1 to 8K of system memory, which meant storage was pretty important, and processors were so slow that any little hacks or tweaks could make a big difference to your codes performance. Even using short variable names instead of long words, made a difference. Nowadays with multi-gigahertz processors and gigabytes of RAM it's more important to make your code readable, modular and easy to maintain. Performance is only really an issue if you are writing games, or other calculation intensive applications.
  Reply With Quote