Optimisation

Nigel Peck nigel.peck at miswebdesign.com
Tue Mar 3 12:17:22 GMT 2009


Mark Morgan wrote:
> On Mon, Mar 2, 2009 at 9:01 PM, Nigel Peck <nigel.peck at miswebdesign.com> wrote:
>> When the list could be empty, which is faster?
>>
>> if ( @list ) { foreach ( @list ) { } }
>>
>> - or just -
>>
>> foreach ( @list ) { }
>>
>> Or is it a pointless question?
> 
> 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.


More information about the london.pm mailing list