xbrlus / xule

An open-source XBRL processor for business rules, rendering and custom data reporting. See https://xbrl.us/xule for documentation and https://xbrl.us/xule-editor for a VS Code syntax highlighter.
Apache License 2.0
24 stars 9 forks source link

Maximum rule iteration count #3

Closed derekgengenbacher-wf closed 2 years ago

derekgengenbacher-wf commented 2 years ago

Description:

There are cases where duplicate facts can cause certain XULE validations to run through a large number of iterations checking every single permutation of the validation. For example section 402 in FERC has a rule that checks a calculation with 14 concepts. If a document happens to have inconsistent duplicate facts in that section, it can cause that rule to explode with memory and time as it churns through every possible permutation of the duplicate facts. In our test file it runs 250,000 iterations which takes 40+ minutes and 40+ GB of memory.

This improvement caps the number of iterations a rule can run to 10,000. If a document has more that 10,000 facts, the threshold becomes the number of facts in the document. This greatly improves speed and memory consumption during validation for documents that are still in working progress.

@davidtauriello

davidtauriello commented 2 years ago

see d4a89e1