aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/evaluator.h
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2017-04-24 11:50:33 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2017-04-26 13:24:01 +0000
commit589021d6eb5d7330d12d0b2efe76dff77f10b0b6 (patch)
treea42f86d847f12f821ce155e13f1af8525c942301 /src/lib/corelib/language/evaluator.h
parent1a440ba0708414843280c2f3e5d65b9f169acb51 (diff)
Merge caches with same key in Evaluator
Reduce hash lookups and memory footprint. ========== Performance data for Resolving ========== Old instruction count: 2465977485 New instruction count: 2457362647 Relative change: -1 % Old peak memory usage: 21248960 Bytes New peak memory usage: 21237680 Bytes Relative change: -1 % ========== Performance data for Rule Execution ========== Old instruction count: 4898426038 New instruction count: 4857983226 Relative change: -1 % Old peak memory usage: 27604240 Bytes New peak memory usage: 27593424 Bytes Relative change: -1 % ========== Performance data for Null Build ========== Old instruction count: 4509789474 New instruction count: 4490616946 Relative change: -1 % Old peak memory usage: 30680456 Bytes New peak memory usage: 30670784 Bytes Relative change: -1 % Change-Id: Ie613447cf9da4bc3d2bfdab42c9a9b5ace643540 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib/corelib/language/evaluator.h')
-rw-r--r--src/lib/corelib/language/evaluator.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/corelib/language/evaluator.h b/src/lib/corelib/language/evaluator.h
index 759cc5d4e..b602326ca 100644
--- a/src/lib/corelib/language/evaluator.h
+++ b/src/lib/corelib/language/evaluator.h
@@ -75,8 +75,14 @@ public:
QStringList stringListValue(const Item *item, const QString &name, bool *propertyWasSet = 0);
QScriptValue scriptValue(const Item *item);
- QScriptValue fileScope(const FileContextConstPtr &file);
- QScriptValue importScope(const FileContextConstPtr &file);
+
+ struct FileContextScopes
+ {
+ QScriptValue fileScope;
+ QScriptValue importScope;
+ };
+
+ FileContextScopes fileContextScopes(const FileContextConstPtr &file);
void setCachingEnabled(bool enabled);
@@ -93,8 +99,7 @@ private:
ScriptEngine *m_scriptEngine;
EvaluatorScriptClass *m_scriptClass;
mutable QHash<const Item *, QScriptValue> m_scriptValueMap;
- mutable QHash<FileContextConstPtr, QScriptValue> m_fileScopeMap;
- mutable QHash<FileContextConstPtr, QScriptValue> m_importScopeMap;
+ mutable QHash<FileContextConstPtr, FileContextScopes> m_fileContextScopesMap;
};
class EvalCacheEnabler