Re: Speed difference

From: Tim Cross <tcross_at_pobox.une.edu.au>
Date: 29 May 2002 08:19:30 +1000
Message-ID: <87n0ujvrt9.fsf_at_blind-bat.une.edu.au>


yf110_at_vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:

> Stjepan Brbot (stjepan.brbot_at_zg.hinet.hr) wrote:
> : What is better?
>
> : IF recstat IN ('NEW','INSERT') THEN
>
> : or
>
> : IF recstat='NEW' OR recstat='INSERT' THEN
>
>
> You should use the logic that correctly mirrors the problem, or is
> consistent with other code.

Yes, I think the difference is very small - by far it is more important to use the one which makes your code as clear as possible. While speed and efficiency use to be a major issue in the past, I think these days maintenance is much more important. My rule of thumb is to try and code things so that they are as clear as possible and then worry about speed and efficiency later if needed.

In your above example, I would probably go for the second alternative if you only have two or so cases, but if you had more I would probably go for the first.

Tim Received on Wed May 29 2002 - 00:19:30 CEST

Original text of this message