in reply to Re^2: Hash space/ time tradeoff
in thread Hash space/ time tradeoff
Given that the OP could have written both approaches, benchmarked them, and chosen whichever came out best in about 10 minutes ...
Actually it's likely that the OP couldn't do that. He spent more time than that writing up the question then waited most of an hour for the first answer. So it looks like a 10 minute fix wasn't available and there's the first hour wasted.
But the advice doesn't pertain to just this single question or to just the OP. As a general thing write code for clarity first then tweak for speed if you need to. Most often scripts are plenty fast enough as first written. If they're not fast enough then profiling is a better first step than guessing and benchmarking. Often the answer to speed problems is found in a different high level approach than low level tweaking in any case. Tweaking may get a factor of two speed improvement. Finding a better algorithm can get orders of magnitude speed improvements.
So, pick your battles and don't sweat the small stuff.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Hash space/ time tradeoff
by educated_foo (Vicar) on Dec 28, 2013 at 05:49 UTC | |
by GrandFather (Saint) on Dec 28, 2013 at 08:41 UTC |