Optimize LinkageMapELF.findConsumers().
authorZac Medico <zmedico@gentoo.org>
Wed, 20 Jul 2011 08:04:00 +0000 (01:04 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 20 Jul 2011 08:04:00 +0000 (01:04 -0700)
If there are no non-excluded providers then there's no need to search
for satisfied consumers.

pym/portage/util/_dyn_libs/LinkageMapELF.py

index 05043d7085dc02d44d4fbc15dc1638f82417d464..218ce2a658073d5f6b98a761dcc8deac8922a1ed 100644 (file)
@@ -710,13 +710,14 @@ class LinkageMapELF(object):
                                                        relevant_dir_keys.add(
                                                                self._path_key(os.path.dirname(p)))
 
-                               for consumer_key in soname_node.consumers:
-                                       _arch, _needed, path, _soname, _consumer_objs = \
-                                               self._obj_properties[consumer_key]
-                                       path_keys = defpath_keys.copy()
-                                       path_keys.update(self._path_key(x) for x in path)
-                                       if relevant_dir_keys.intersection(path_keys):
-                                               satisfied_consumer_keys.add(consumer_key)
+                               if relevant_dir_keys:
+                                       for consumer_key in soname_node.consumers:
+                                               _arch, _needed, path, _soname, _consumer_objs = \
+                                                       self._obj_properties[consumer_key]
+                                               path_keys = defpath_keys.copy()
+                                               path_keys.update(self._path_key(x) for x in path)
+                                               if relevant_dir_keys.intersection(path_keys):
+                                                       satisfied_consumer_keys.add(consumer_key)
 
                rValue = set()
                if soname_node is not None: