Optimisation

Andy Armstrong andy at hexten.net
Tue Mar 3 12:45:06 GMT 2009


On 3 Mar 2009, at 12:17, Nigel Peck wrote:
>> Sounds like a definite case of premature optimisation.  If it's not
>> causing issues for production code, ignore it.  If it is, then  
>> there's
>> very likely much bigger problems....
>
> I'm just asking because I try to think about optimisation as I'm  
> writing code, rather than going back and doing it later, which I've  
> only done in rare cases.


Think mainly about algorithm choice at write time - O(NlogN) always  
beats O(N^2). Go back and do performance tweaks like the one we're  
discussing only if the code proves too slow in practice.

The rules of optmisation:

Rule 1: don't optimise.
Rule 2: (experts only) don't optimise - yet.

-- 
Andy Armstrong, Hexten



More information about the london.pm mailing list