summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2012-12-08 20:45:34 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2012-12-08 20:47:46 +0100
commitc38e5f38fcc0264c9d63a544cfdd8bcf6d8fec6c (patch)
treef664f68b3b923631e19a3872b9f8e8188a4c402c
parent4aaa095d99832465f7bf0dbccaeb0f090c0dcae2 (diff)
Reuse cached deps from other symbols in _get_dependent().
Speeds up allnoconfig_simpler.py by 30%.
-rw-r--r--kconfiglib.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 15a5c1c..1337811 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -1575,6 +1575,8 @@ might be an error, and you should e-mail kconfiglib@gmail.com.
for sym in self.syms.itervalues():
self.dep[sym] = set()
+ # Adds 'sym' as a directly dependent symbol to all symbols that appear
+ # in the expression 'e'
def add_expr_deps(e, sym):
for s in self._get_expr_syms(e):
self.dep[s].add(sym)
@@ -2939,6 +2941,12 @@ class Symbol(Item, _HasVisibility):
res = set()
def rec(sym, ignore_choice = False):
+ # If the dependencies of the symbol have already been calculated,
+ # then reuse that
+ if sym.cached_deps is not None:
+ res.update(sym.cached_deps)
+ return
+
for s in self.config.dep[sym]:
if s not in res:
res.add(s)