diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-10-22 14:38:05 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-10-22 22:42:21 +0200 |
| commit | 72eca77f6d1bc06accebf187f590ceb2d3b5ab04 (patch) | |
| tree | 95168191e6dfd4b4740f7ef5b3b3cae5deb3d9c1 /kconfiglib.py | |
| parent | afcf6785aec12b2671b8b9e7b70b2954361905b0 (diff) | |
Micro-optimize _make_depend_on() calls
Store the function in a local variable outside the loop in _build_dep().
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index a93ca0d..4f60251 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2987,6 +2987,9 @@ class Kconfig(object): # The calculated sets might be larger than necessary as we don't do any # complex analysis of the expressions. + # Optimization + make_depend_on = _make_depend_on + # Only calculate _dependents for defined symbols. Constant and # undefined symbols could theoretically be selected/implied, but it # wouldn't change their value, so it's not a true dependency. @@ -2996,29 +2999,29 @@ class Kconfig(object): # The prompt conditions for node in sym.nodes: if node.prompt: - _make_depend_on(sym, node.prompt[1]) + make_depend_on(sym, node.prompt[1]) # The default values and their conditions for value, cond in sym.defaults: - _make_depend_on(sym, value) - _make_depend_on(sym, cond) + make_depend_on(sym, value) + make_depend_on(sym, cond) # The reverse and weak reverse dependencies - _make_depend_on(sym, sym.rev_dep) - _make_depend_on(sym, sym.weak_rev_dep) + make_depend_on(sym, sym.rev_dep) + make_depend_on(sym, sym.weak_rev_dep) # The ranges along with their conditions for low, high, cond in sym.ranges: - _make_depend_on(sym, low) - _make_depend_on(sym, high) - _make_depend_on(sym, cond) + make_depend_on(sym, low) + make_depend_on(sym, high) + make_depend_on(sym, cond) # The direct dependencies. This is usually redundant, as the direct # dependencies get propagated to properties, but it's needed to get # invalidation solid for 'imply', which only checks the direct # dependencies (even if there are no properties to propagate it # to). - _make_depend_on(sym, sym.direct_dep) + make_depend_on(sym, sym.direct_dep) # In addition to the above, choice symbols depend on the choice # they're in, but that's handled automatically since the Choice is @@ -3031,11 +3034,11 @@ class Kconfig(object): # The prompt conditions for node in choice.nodes: if node.prompt: - _make_depend_on(choice, node.prompt[1]) + make_depend_on(choice, node.prompt[1]) # The default symbol conditions for _, cond in choice.defaults: - _make_depend_on(choice, cond) + make_depend_on(choice, cond) def _add_choice_deps(self): # Choices also depend on the choice symbols themselves, because the |
