summaryrefslogtreecommitdiffstats
path: root/util/cmake/condition_simplifier.py
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-09-30 18:16:20 +0200
committerTobias Hunger <tobias.hunger@qt.io>2019-10-01 14:14:16 +0000
commitf23b7e1476ded2be43d5e3f03195f522d307b163 (patch)
tree76c5fa3d2de29fbbedc01a6647198b6f123fbaa6 /util/cmake/condition_simplifier.py
parent590213e531f3a14f9b5365a10122f815d5fd6e8f (diff)
Implement persistent caching for simplify_condition
Store the results of simplify_condition in a json cache file, next to the pro2cmake.py script. Dramatically speeds up re-conversion of projects. The cache is cleared whenever the content of the condition_simplifier.py file changes, effectively presuming that the condition computing code has changed. Sample times. Initial corelib.pro conversion - 142.13 seconds. Next re-conversion with hot cache - 1.17 seconds. Change-Id: I8790b2736358236e4b23bcb5f10f45a36fdfa426 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
Diffstat (limited to 'util/cmake/condition_simplifier.py')
-rw-r--r--util/cmake/condition_simplifier.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cmake/condition_simplifier.py b/util/cmake/condition_simplifier.py
index c67b78ffad..de329be1d4 100644
--- a/util/cmake/condition_simplifier.py
+++ b/util/cmake/condition_simplifier.py
@@ -29,8 +29,8 @@
import re
-
from sympy import simplify_logic, And, Or, Not, SympifyError
+from condition_simplifier_cache import simplify_condition_memoize
def _iterate_expr_tree(expr, op, matches):
@@ -160,6 +160,7 @@ def _recursive_simplify(expr):
return expr
+@simplify_condition_memoize
def simplify_condition(condition: str) -> str:
input_condition = condition.strip()