Rule Evaluation taking around 10,000-15,000 ms for around 10k rules.
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- backend, performance
Research direction
No repository file, test, or entry point is named. Start by reproducing the reported evaluation with the provided rule shape and approximately 10k rules, then profile the evaluation path and document the limiting operation; done means a measured cause and validated performance improvement.
Written by the indexing model from the issue text.
Description
hi @CacheControl , We are using json-rule-engine in our project to get outcome by evaluating around 10k records stored in mongodb.
I am sharing one rule for your reference. We have 10k record like this in our project and evaluating it against facts takes around 10-15 seconds.
{
"conditions": {
"all": [
{
"fact": "customer_delivery_address",
"operator": "equal",
"factLabel": "Customer Delivery Address",
"value": "GB",
"valueSet": [
{
"value": "GB",
"label": "GB"
}
]
},
{
"fact": "customer_tier",
"operator": "equal",
"factLabel": "Customer Tier",
"value": "gold",
"valueSet": [
{
"value": "gold",
"label": "Gold"
}
]
},
{
"fact": "new_customer",
"operator": "isBoolean",
"factLabel": "New Customer",
"value": true,
"valueSet": [
{
"value": true,
"label": true
}
]
},
{
"fact": "order_amount",
"operator": "greaterThan",
"factLabel": "Order Amount",
"value": 2500,
"valueSet": [
{
"value": 2500,
"label": "2500"
}
]
},
{
"fact": "order_count",
"operator": "lessThan",
"factLabel": "Order Count",
"value": 100,
"valueSet": [
{
"value": 100,
"label": "100"
}
]
},
{
"fact": "order_date",
"operator": "isDateGreaterThan",
"factLabel": "Order Date",
"value": "2024-02-01T05:15:44Z",
"valueSet": [
{
"value": "2024-02-01T05:15:44Z",
"label": "2024-02-01T05:15:44Z"
}
]
},
{
"fact": "order_date",
"operator": "isDateLessThan",
"factLabel": "Order Date",
"value": "2024-03-01T05:10:50Z",
"valueSet": [
{
"value": "2024-03-01T05:10:50Z",
"label": "2024-03-01T05:10:50Z"
}
]
},
{
"fact": "order_state",
"operator": "equal",
"factLabel": "Order State",
"value": "confirmed",
"valueSet": [
{
"value": "confirmed",
"label": "Confirmed"
}
]
},
{
"fact": "payment_state",
"operator": "equal",
"factLabel": "Payment State",
"value": "paid",
"valueSet": [
{
"value": "paid",
"label": "Paid"
}
]
},
{
"fact": "customers",
"operator": "equal",
"factLabel": "Customers",
"value": "sample@gmail.com",
"valueSet": [
{
"value": "sample@gmail.com",
"label": "sample@gmail.com"
}
]
}
]
},
"event": {
"type": "categories",
"params": {
"label": "Category",
"value": "Fitness Kit",
"key": "8173dfd1-d8a1-417d-ab78-07dfa6799f59",
"operator": "is",
"source": "resource"
}
}
}
Can you please help me understand why it is taking so much time to evaluate this type of rule. If possible please share solutions for improving performance also.
- Dominant language
- JavaScript
- Stars
- 3.1k
- Forks
- 507
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CacheControl/json-rules-engine
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
CacheControl/json-rules-engine#427 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
CacheControl/json-rules-engine#424 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
CacheControl/json-rules-engine#421 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
CacheControl/json-rules-engine#417 · 1 reaction ·
All issues in CacheControl/json-rules-engine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·