aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/evaluator.h
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2016-11-08 10:14:34 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2016-11-10 12:00:00 +0000
commitb0160eb96e47a20f2ac28b7dbb327c87460cb9da (patch)
treea5cae2192beca34c56995b68721669e986c62ccc /src/lib/corelib/language/evaluator.h
parenta96116df6e01e131867f406695300959c9872527 (diff)
Enable evaluation cache for module validation
After the modules have been merged and all Probes have run, the cache can be enabled, preventing unnecessary re-evaluation of properties accessed in the validation script. Output of qbs_benchmarker on Linux using qbs itself as the test project: ========== Performance data for Resolving ========== Old instruction count: 1817936584 New instruction count: 1696757221 Relative change: -7 % Old peak memory usage: 2714982 Bytes New peak memory usage: 2743848 Bytes Relative change: +1 % This does not technically fix the bug mentioned below, but alleviates the pain caused by it. Task-number: QBS-1033 Change-Id: Ib0041067ff82a2f4b1818e6f76259d544e5184bd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/language/evaluator.h')
-rw-r--r--src/lib/corelib/language/evaluator.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/corelib/language/evaluator.h b/src/lib/corelib/language/evaluator.h
index 3701935d3..2c12abb34 100644
--- a/src/lib/corelib/language/evaluator.h
+++ b/src/lib/corelib/language/evaluator.h
@@ -95,6 +95,20 @@ private:
mutable QHash<FileContextConstPtr, QScriptValue> m_fileScopeMap;
};
+class EvalCacheEnabler
+{
+public:
+ EvalCacheEnabler(Evaluator *evaluator) : m_evaluator(evaluator)
+ {
+ m_evaluator->setCachingEnabled(true);
+ }
+
+ ~EvalCacheEnabler() { m_evaluator->setCachingEnabled(false); }
+
+private:
+ Evaluator * const m_evaluator;
+};
+
} // namespace Internal
} // namespace qbs