More rules or Otherwise?
Hello Guys,
performance side, is it better to have :
Rule 1 : When X = 3 Then DO that
Rule 2 : When X = 4 Then Do that
Rule 3 : When X = 5 Then Do that
or this :
Rule 1 : When X =3 Then Do that
Otherwise When X = 4 Then Do that
Otherwise etc.
So One complicated Rule against, X rules? What do you think is the best for perf? thanks guys
performance side, is it better to have :
Rule 1 : When X = 3 Then DO that
Rule 2 : When X = 4 Then Do that
Rule 3 : When X = 5 Then Do that
or this :
Rule 1 : When X =3 Then Do that
Otherwise When X = 4 Then Do that
Otherwise etc.
So One complicated Rule against, X rules? What do you think is the best for perf? thanks guys
Comments
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
mainRule with condition: when
Attribute n > 1 (here the computer reads/stores n value)
---Rule when x = 3 do this (here the computer compares 3 to 0)
(if = …returns 1…true… initiates event...and stops reading mainRule)
(if ≠ …returns 0…false… continues reading)
---Rule when x = 4 do this (here the computer compares 4 to 0)
(if = ...returns 1…true… initiates event..and stops reading mainRule)
(if ≠ ...returns 0…false… continues reading)
---Rule when x = 5 do that (here the computer compares 5 to 0)
(if = ...returns 1…true… initiates event..and stops reading mainRule)
(if ≠ ...returns 0…false…continues reading)
Otherwise: (if above comparisons return 0 ...false)
---do something else (initiate event)
as the computer does this in nanoseconds…
all this doesn’t too much matter … but we all want things to happen instantaneously…
so we should strive to write sequential code efficiently…thus we should nest rules that concern a particular state/attribute.
MH