profile cumulative time for all NACs

This commit is contained in:
Joeri Exelmans 2024-11-25 13:48:57 +01:00
parent 38e120e6c8
commit b6a654580c

View file

@ -50,6 +50,7 @@ class RuleMatcherRewriter:
nac_matched = False
with Timer(f"MATCH NACs {rule_name}"):
try:
for i_nac, nac in enumerate(nacs):
# For every LHS-match, we see if there is a NAC-match:
@ -66,15 +67,12 @@ class RuleMatcherRewriter:
try:
with Timer(f"MATCH NAC{i_nac} {rule_name}"):
nac_match = nac_matcher.__next__()
# The NAC has at least one match
# (there could be more, but we know enough, so let's not waste CPU/MEM resources and proceed to next LHS match)
raise _NAC_MATCHED()
except StopIteration:
break # no more nac-matches
# The NAC has at least one match
# (there could be more, but we know enough, so let's not waste CPU/MEM resources and proceed to next LHS match)
nac_matched = True
break
except Exception as e:
# The exception may originate from eval'ed condition-code in LHS or NAC
# Decorate exception with some context, to help with debugging