From 0fb2f672cefb7e5a910c2d2bda91c45e37d627e1 Mon Sep 17 00:00:00 2001
From: Tim Jammer <tim.jammer@tu-darmstadt.de>
Date: Mon, 29 Apr 2024 13:55:19 +0200
Subject: [PATCH] efficiency of filtering

---
 scripts/errors/coll/ParamMatchingType.py | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/scripts/errors/coll/ParamMatchingType.py b/scripts/errors/coll/ParamMatchingType.py
index 8680e4f75..f8757a22a 100644
--- a/scripts/errors/coll/ParamMatchingType.py
+++ b/scripts/errors/coll/ParamMatchingType.py
@@ -145,23 +145,22 @@ class InvalidComErrorColl(ErrorGenerator):
 
     def generate(self, generate_level, real_world_score_table):
 
+        types = predefined_types + user_defined_types
         combinations_to_use = []
         for f in self.functions_to_use:
-            for t1 in predefined_types + user_defined_types:
-                for t2 in predefined_types + user_defined_types:
-                    for comm in predefined_comms + comm_creators + intercomms:
+            for comm in predefined_comms + comm_creators + intercomms:
+                for i, t1 in enumerate(types):
+                    if generate_level == REAL_WORLD_TEST_LEVEL and not is_combination_important(real_world_score_table,
+                                                                                                f, datatype=t1.lower(),
+                                                                                                communicator=comm):
+                        continue
+                    for t2 in types[i:]:
+                        if generate_level == REAL_WORLD_TEST_LEVEL and not is_combination_important(
+                                real_world_score_table, f, datatype=t2.lower(), communicator=comm):
+                            continue
                         if is_combination_compatible(t1, t2, f):
                             combinations_to_use.append((t1, t2, f, comm))
 
-        if generate_level == REAL_WORLD_TEST_LEVEL:
-            combinations_to_use = [(t1, t2, f, comm) for (t1, t2, f, comm) in combinations_to_use if
-                                   is_combination_important(real_world_score_table,
-                                                            f, datatype=t1.lower(),
-                                                            communicator=comm) and
-                                   is_combination_important(real_world_score_table,
-                                                            f, datatype=t2.lower(),
-                                                            communicator=comm)]
-
         if generate_level == SUFFICIENT_TEST_LEVEL:
             types_checked = set()
             combinations_to_use_filtered = []
-- 
GitLab