"Premature optimization is the root of all evil."
-- Computer Science Proverb
This quote may seem strange, but by "optimization," they mean "fancy tricks to make your code work better," and by "Premature," they mean "before you've checked to make sure it works right in the first place."
If you make your code too fancy and then make a mistake somewhere, it'll be impossible to catch. Because it will be too complicated. First concentrate on making sure it's right. Then do the fancy tricks to speed it up. Besides, CPUs are very fast these days. It's okay to losing a few cycles to making sure its done correctly.
This is not to say that optimization should never be done. As an example, the computer game "Wolfenstein" would have been too slow to be playable if it had simulated everything it claimed to. It was only functional because of all the crazy shortcuts that made it fast enough to play.
Perhaps this is true in other fields too. First correct, then faster, better, or cheaper.