From 70a9eb0668b51934f8d79f0c037d65aeb440bcef Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 1 Nov 2017 02:02:45 +0100 Subject: Switch to a much faster invalidation algorithm _cached_vis is always calculated as a side effect of calculating any other cached value, and so doubles as a flag for whether an item (symbol or choice) has any cached values. If _cached_vis is None for some item, it also indirectly means that no other item can have any cached values that (actually) depend on the item, because _cached_vis would have gotten calculated as a side effect of calculating any such cached value. Therefore, it's safe to stop recursive invalidation at an item that has _cached_vis None. Huge speedup for the allyes/noconfig*.py scripts. allnoconfig_simpler.py went from 2.671 seconds to 1.067 seconds. The dependency selftests need to be updated too now that _get_dependent() is gone. The kernel defconfig tests pass even if all global invalidation is disabled at least (except for the few defconfigs that don't set MODULES=y), and that's a huge invalidation test. Seems pretty speedy too, even though there's some redundant work, so maybe things could be simplified a bit... --- examples/allnoconfig.py | 4 ++-- examples/allnoconfig_simpler.py | 13 ------------- 2 files changed, 2 insertions(+), 15 deletions(-) (limited to 'examples') diff --git a/examples/allnoconfig.py b/examples/allnoconfig.py index be36b47..3b7fd31 100644 --- a/examples/allnoconfig.py +++ b/examples/allnoconfig.py @@ -1,8 +1,8 @@ # Works like 'make allnoconfig'. Verified by the test suite to generate # identical output to 'make allnoconfig' for all ARCHes. # -# See allnoconfig_simpler.py for a much simpler version. This version -# demonstrates some tree walking and value processing. +# See allnoconfig_simpler.py for a much simpler version. This more roundabout +# version demonstrates some tree walking and value processing. # # Usage: # diff --git a/examples/allnoconfig_simpler.py b/examples/allnoconfig_simpler.py index 59a1bd4..81e701c 100644 --- a/examples/allnoconfig_simpler.py +++ b/examples/allnoconfig_simpler.py @@ -5,19 +5,6 @@ # Usage: # # $ make [ARCH=] scriptconfig SCRIPT=Kconfiglib/examples/allnoconfig_simpler.py -# -# Implementation/performance note -# =============================== -# -# Kconfiglib immediately invalidates (flags for recalculation) all (possibly) -# dependent symbols when a value is assigned to a symbol, which slows this down -# a bit (due to tons of redundant invalidation), but makes any assignment -# pattern safe ("just works"). Kconfig.load_config() instead invalidates all -# symbols up front, making it much faster. If you really need to eke out -# performance, look at how load_config() does things (which involves internal -# APIs that don't invalidate symbols). This has been fast enough for all cases -# I've seen so far though (around 3 seconds for this particular script on my -# Core i7 2600K, including the initial Kconfig parsing). from kconfiglib import Kconfig, BOOL, TRISTATE import sys -- cgit v1.2.3