aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compileddata_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-07-26 12:02:03 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-31 17:08:46 +0000
commit2312f5a2b4fd775933f54c9d8435ea047de2310a (patch)
tree77c5c5f7547846c371a4a99b2fac48100f0d6b3b /src/qml/compiler/qv4compileddata_p.h
parent193db4c52613a37275535783825190ddd7e1f758 (diff)
Reduce memory usage caused by strings with AOT cache files
For AOT loaded cache files, the CompiledData::Unit we produce is ephemeral by design. That same applies to the strings, where we don't really need to write out a new string table but we might as well just keep the QStringList around. That avoids copying all the string data and saves another 21K RAM with the gallery. It might even save a little more if some of the new strings are truly shared via implicit QString sharing. Also their "extraction" via stringAt(index) becomes as fast as for the strings that come from mmap'ed memory - with no copying involved. Task-number: QTBUG-69588 Change-Id: I06cf0f083e3b8d3c5dbabb22beb0711f88fc8692 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compileddata_p.h')
-rw-r--r--src/qml/compiler/qv4compileddata_p.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 1120567d2a..a891a761eb 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -1082,6 +1082,7 @@ public:
QScopedPointer<CompilationUnitMapper> backingFile;
const QV4::CompiledData::Unit *backingUnit = nullptr;
+ QStringList dynamicStrings;
// --- interface for QQmlPropertyCacheCreator
typedef Object CompiledObject;
@@ -1094,6 +1095,8 @@ public:
if (index < backingUnitStringTableSize)
return backingUnit->stringAtInternal(index);
index -= backingUnitStringTableSize;
+ Q_ASSERT(data->stringTableSize == 0);
+ return dynamicStrings.at(index);
}
return data->stringAtInternal(index);
}