Performance Impact due to Expression builder in When rule

Hi This is very basic question , To understand the When Rule best practices ,

Note: I am using below mention When rule in CDH project where to check eligibility crietria which means this when rule can be executed against few million cutomers data hence trying to understand a best practice .

Example of when condition .

business Requriement :

Users are eligible if balance amount is greater than 0 but less than 2000000

and maturity date is in next 15 days.

Option 1 to create when rule :

A - balance amount > 0

B - balance amount < 2000000

C maturity date > current date

D maturity date < current date + 15

Logic : ( A AND B AND C AND D )

Option 2 for when rule :

A - (balance amount > 0 && balance amount < 2000000 )

B - ( maturity date > current date && maturity date < current date + 15 )

Logic : ( A AND B )

Please suggest which is the best option for performance . certainly Option 1 is good for Business user as its more readable but at the same time I am trying to understand is there any considerable performance improvement if I go with Option2.

Or please suggest any better option whcih can improve perfromance considerably .

Thanks in advacne.

@ChetanD5675 Hi , instead of current date + 15, if we do addtodatetime and set it in a param or property, that will improve the performance and I believe both option A and B have the same performance.

@ChetanD5675

Use functions as much as possible eg: instead of current date + 15 use @addCalender() etc.

Avoid hardcoding values eg: instead of hardcoding 2000000, refer it from parameter/decision table/DSS etc. so that its easier for the user to configure.

Granularizing when rules steps is always a better option, then Pega needs to process less for each field.

@GiridharanVenkat Thanks for your reply. current date + 15 thats psuedo code and in actual condition we are using fucntions only.

I was more concerened about performance which according to you more or less same,

Thanks for that

@ChetanD5675

· isBalanceInRange(balanceAmount): This function the balance amount is within the specified range.

· isMaturityDateWithinNextDays(maturityDate, days**)**: This checks if the maturity date is within the next specified number of days from the current date.

@SohamM95 Thanks . will take your feedback on granularizing when rules .