Comparisons and Conditions

Conditions and comparisons can be accelerated by the compiler support through their own thoughts about the program. With AND, for example. The compiler must perform all the specified individual expressions, so that it can check whether all satisfy the required condition. This is because he has no overview of the program logic and can not know whether the programmer in his condition actually making a bit combination or a logical query. In order to assist the compiler to split complex logical conditions. While this may generate some more code, but then much faster in execution speed.

Before

if a=1 and b=getByte() and (c or d) then
  [..]
end if

After

if a=1 then
  if b=getByte() then
    if c or d then
      [..]
    end if
  end if
end if

For multiple comparisons with constants it is faster and more efficient if possible, always a select-case - query.

Before

if a=1 or a=3 or a=200 or (a>=210 and a<=220) then
  [..]
else
  [..]
end if

After

select case a
case 1,3,200,210 to 220
  [..]
default
  [..]
end select