Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit 0bd7024

Browse files
author
Joshua Reich
committed
optimize sequential cross when r1 drops
1 parent 9408f83 commit 0bd7024

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pyretic/core/classifier.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,13 @@ def _cross(r1,r2):
280280
# then for each rule in the first classifier (self)
281281
c3 = Classifier()
282282
for r1 in c1.rules:
283-
for r2 in c2.rules:
284-
c_tmp = _cross(r1,r2)
285-
if not c_tmp is None:
286-
c3.append(c_tmp)
283+
if r1.actions == {drop}:
284+
c3.append(r1)
285+
else:
286+
for r2 in c2.rules:
287+
c_tmp = _cross(r1,r2)
288+
if not c_tmp is None:
289+
c3.append(c_tmp)
287290
# when all rules in c1 and c2 have been crossed
288291
# optimize c3
289292
c3 = c3.optimize()

0 commit comments

Comments
 (0)