Hi,

I've mentioned the test case I'm working on before. It's: If a certain value exceeds a limit more than X times within Y minutes/hours, do something.
  ~> Count = X  ,  time = Y

During a talk with other developers it came up that by intuition the men would have chosen a other approach than the women. We can not agree if in Drools both approaches are the same in performance or if one is more performant.
Male approach: If a new event with a limit violation is received, check if within the last time Y already X events with limit violations are contained in the knowledge base .

Female approach: If a new event with a limit violation is received, check if the following events contain X events with limit violation. This is limited to a monitoring time of maximal Y. (If there have been X events registered, before the time Y is elapsed, the window will be closed right away.)

In code with Y = 1h it would be:
Male:
// determine new event as $triggeringEvent
$otherEvent : Value (this before[0ms,1h] $triggeringEvent)
Female:
// determine event that opened the window as $triggeringEvent
$otherEvent : Value (this after[0ms,1h] $triggeringEvent)

This is just a extract so that that the comments are in fact meaningless. The focus lies on before and after.


Is one solution more efficient?


Thanks! :)
Tina