Details
-
Technical task
-
Resolution: Done
-
P2: Important
-
None
Description
The QML engine creates cache files that contain a dump of internal data structures on the fly when loading a .qml or .js file at run-time. These files are be mmap'ed and used right away. The only data structure that needs to be created from these are property caches.
The qmlcachegen command line tool as well as CONFIG+=qtquickcompiler (or the cmake equivalent) make it possible to build these cache files ahead of time.
Unfortunately at the time this step happens, the generator for these caches does not have the same degree of visibility into the type system as the QML engine at run-time. For example for signal handlers we cannot determine the names of the parameters yet. These limitations lead to a staged approach of using ahead-of-time generated cache files that skips the entire byte code generation - that has been done offline and can be re-used - but otherwise reconstructs the internal data structures. Those are subsequently used to perform a full type compilation and that also involves creating new data structures from the CompiledData name space.
In 5.12 we can reduce the memory consumption when using such ahead-of-time generated cache files with two relatively unintrusive changes:
(1) Avoid the re-creation of the indexed string table for the in-memory generated compilation unit and instead fall back to the memory mapped string table provided from the cache file.
(2) Reduce the size of data structures in the CompiledData namespace so that their duplication reduces the size of the files as well as their memory consumption.
Attachments
For Gerrit Dashboard: QTBUG-69588 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
234985,10 | Shrink function objects by 12 bytes | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
234986,11 | Reduce the size of CompiledData::Object | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
234987,11 | Shrink the size of CompiledData::Function by 16 bytes | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
234991,15 | Shrink CompiledData::Binding by 8 bytes | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
234992,17 | Shrink CompiledData::Function by 8 bytes | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
234993,17 | Reduce memory usage when loading QML files from AOT generated caches | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
235071,19 | Optimize memory consumption of ahead-of-time compile cache files | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
235349,11 | Reduce memory usage caused by strings with AOT cache files | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
235421,16 | Reduce memory consumption when loading AOT generated cache files | dev | qt/qtdeclarative | Status: MERGED | -2 | 0 |