Bug #9835
The same rules files are loaded and compiled multiple times
100%
Related issues
History
#1 Updated by Octavian Adrian Gavril over 1 year ago
During a tags count in TRPL, it was found that many .rules files are loaded and compiled multiple times. This suggests a performance gap.
See #1745-27. Greg wrote:
I think we should be able to reuse the same loaded code in many places, though we will have to ensure that we fix usage of "global data" such that we don't rely upon any variable references outside of the current file-level scope. I wonder what performance improvement we can get by this.
#2 Updated by Octavian Adrian Gavril over 1 year ago
- Related to Feature #1745: review, decide upon and document the 1.0 features which will be retained in 2.0 added
#3 Updated by Octavian Adrian Gavril over 1 year ago
- Status changed from New to WIP
#4 Updated by Octavian Adrian Gavril over 1 year ago
I've started implementing a mechanism to prevent loading the same .rules file multiple times. While analyzing ConfigLoader, I noticed that caching firstRuleSet, lastRuleContainer, and lastNamedFunction helps maintain a processed state for the .rules file.
However, it looks like there may be other attributes that also need to be preserved to ensure things work correctly when the same file is used again in a different context. Right now, I'm running into some NPEs when expressions are being executed, likely due to missing context.
Would it be OK if I commit these changes directly to 1745a, or would you prefer I create a separate task branch? Keep in mind that 1745a is already using some maps to avoid duplicate logging, so it might make sense to keep the changes together.
#5 Updated by Greg Shah over 1 year ago
Yes, you can use 1745a.
#7 Updated by Octavian Adrian Gavril 13 days ago
Greg Shah wrote:
Is this still an issue after implementation of 1752a?
Yes, this is still an issue in trunk. 1752a did not touch rules loading.
#8 Updated by Octavian Adrian Gavril 9 days ago
- Status changed from WIP to Review
- % Done changed from 0 to 100
- reviewer Greg Shah added
I've committed some changes in 1745a/16768 that implement the cache for parsed profile documents, so that a .rules file that is included or referenced from many places is read and parsed only once.
Greg, please review.
#9 Updated by Octavian Adrian Gavril 2 days ago
Created task branch 9835a.
I uncommitted the latest changes about cached profile documents from 1745a/16768 and moved them to 9835a/16765.
Greg, please review 9835a.