Improve CPU consumption
pasendra opened this issue · 4 comments
Describe the bug
Everytime a KnowledgeBase is cloned, the entry is cloned and a snapshot is created to compare the actual entry with the cloned one.
We've noticed in one of our apps, that the function GetSnapshot consumes a lot of CPU everytime is called.
Is there any chance to skip the following code in RuleEntry.go
in order to improve the cpu consumption?
if e.GetSnapshot() != clone.GetSnapshot() {
I don't mind to fork and create a Pull Request, but I would like to discuss what to do :)
Hi @pasendra
I can recall that this snapshot comparison between the original and cloned rule entry are for testing purpose. I realized that this should be inside a test, not here. And I've never witnessed the cloning process breaks the AST integrity in production. So I think its ok to move the comparison from RuleEntry.go to RuleEntry_test.go.
Thanks for pointing this out.
Excellent, thanks @newm4n . Are you going to do the change or you want me to do that? Regards.
Hi @newm4n
When will the new Tag be released for this fix?