FrederikP commented on issue #3500: NIFI-6322: Reuse evaluator stored in CompiledExpression when creating a query. URL: https://github.com/apache/nifi/pull/3500#issuecomment-498551551 In our local performance test we noticed that iterating through the allEvaluators Set in CompiledExpression is not the best idea. So for now I introduced another default in the Evaluator interface: `cleanUpNeeded` There is an additional array containing only the stateful evaluators of the tree that need cleanup. That should be better for performance. We are probably going to deploy self-built version using this PR on our cluster after some more testing to see how it impacts CPU usage. We'll let you know how it goes. Different subject: The problem with `OrEvaluator` and `AndEvaluator` also exists for PR #3277 . You can test that by using `${hello:contains('H'):and(${hello:contains('o')})}` and changing the value of hello from `Hello` to `Hell` between calls with one PreparedQuery. The result will be `true` in both cases if you start with `Hello`, even though it should not be. Including those essential functions (`and` + `or`) in the group where the evaluator tree is rebuilt for each call would mean that many of the expressions we use in production wouldn't benefit from the performance gains of PR #3277 . Another idea, if you don't like using the new default interface methods in `Evaluator` would be to use some kind of a evaluation context that is passed through the tree. It can cache sub results during one evaluation and a new context would be passed for each new evaluation. That way we could get rid of having state in the evaluators itself. That would be a bigger change to the structure though.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
