profile cumulative time for all NACs
This commit is contained in:
parent
38e120e6c8
commit
b6a654580c
1 changed files with 28 additions and 30 deletions
|
|
@ -50,6 +50,7 @@ class RuleMatcherRewriter:
|
||||||
|
|
||||||
nac_matched = False
|
nac_matched = False
|
||||||
|
|
||||||
|
with Timer(f"MATCH NACs {rule_name}"):
|
||||||
try:
|
try:
|
||||||
for i_nac, nac in enumerate(nacs):
|
for i_nac, nac in enumerate(nacs):
|
||||||
# For every LHS-match, we see if there is a NAC-match:
|
# For every LHS-match, we see if there is a NAC-match:
|
||||||
|
|
@ -66,15 +67,12 @@ class RuleMatcherRewriter:
|
||||||
try:
|
try:
|
||||||
with Timer(f"MATCH NAC{i_nac} {rule_name}"):
|
with Timer(f"MATCH NAC{i_nac} {rule_name}"):
|
||||||
nac_match = nac_matcher.__next__()
|
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()
|
raise _NAC_MATCHED()
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
break # no more nac-matches
|
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:
|
except Exception as e:
|
||||||
# The exception may originate from eval'ed condition-code in LHS or NAC
|
# The exception may originate from eval'ed condition-code in LHS or NAC
|
||||||
# Decorate exception with some context, to help with debugging
|
# Decorate exception with some context, to help with debugging
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue