]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Change the avoid list to a set for lookups.
authorCollin Funk <collin.funk1@gmail.com>
Tue, 9 Apr 2024 16:11:03 +0000 (09:11 -0700)
committerBruno Haible <bruno@clisp.org>
Tue, 9 Apr 2024 16:30:52 +0000 (18:30 +0200)
* pygnulib/GLModuleSystem.py (GLModuleSystem.__init__): Store the
avoided modules in a set instead of a list. This is used only for
membership checks when computing the transitive closure of the given
modules, therefore prefer the O(1) average case over O(n).

ChangeLog
pygnulib/GLModuleSystem.py

index 8a09d0668f496eb6dbc932b5d366bbf0dfe40957..033eb5dc92fd662afe1e8c48ec2717a21ab8d442 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-04-09  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Change the avoid list to a set for lookups.
+       * pygnulib/GLModuleSystem.py (GLModuleSystem.__init__): Store the
+       avoided modules in a set instead of a list. This is used only for
+       membership checks when computing the transitive closure of the given
+       modules, therefore prefer the O(1) average case over O(n).
+
 2024-04-09  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Remove unused setter and getter functions.
index 3669ac9754df03b5aba954d5ab24cc154d8919bc..ed96b9846c5abdd459305398f1932e16b28d4b66 100644 (file)
@@ -750,11 +750,11 @@ class GLModuleTable:
                             % type(inc_all_direct_tests).__name__)
         self.inc_all_direct_tests = inc_all_direct_tests
         self.inc_all_indirect_tests = inc_all_indirect_tests
-        self.avoids = []  # Avoids
+        self.avoids = set()
         for avoid in self.config.getAvoids():
             module = self.modulesystem.find(avoid)
             if module:
-                self.avoids.append(module)
+                self.avoids.add(module)
 
     def __repr__(self) -> str:
         '''x.__repr__() <==> repr(x)'''