Boolean Processing Optimization

I had heard that removing IF THEN ELSE from boolean formulas is more efficient. For example:

a = 1 AND b = 2

is better than:

IF a =1 THEN IF b =2 THEN TRUE ELSE FALSE

The reasoning I was given was that Anaplan will process conditions a and b in parallel for the first formula, but sequentially for the second. Is this true?

Best Answer

  • rob_marshall
    Answer ✓

    @CWheeler96

    You hear correct. An IF/THEN/ELSE statement has three different calculations contained in it: the IF part, the THEN part, and the ELSE part. In using a boolean as you did, a = 1 AND b = 2, is way more efficient as it resolves to either true or false and there are only 2 calculations whereas

    IF a =1 THEN IF b =2 THEN TRUE ELSE FALSE

    has 4 calculations.

    Hope this helps,

    Rob

Answers

  • @CWheeler96 ,I believe second program is written in sequential way where program validate all values of a and then go for validation of b. if you rewrite first expression, a= 1 and b=2 into if a=1 and b=2 then TRUE else FALSE, it might have same parallel execution