Optimisation
Jasper
jaspermccrea at gmail.com
Tue Mar 3 12:22:01 GMT 2009
2009/3/3 Nigel Peck <nigel.peck at miswebdesign.com>:
> 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.
It's ironically sub-optimal to have wasted so much of your and our
time on something so trivial. ;)
Joss Whedon has a new tv show.
--
Jasper
More information about the london.pm
mailing list