diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2022-10-24 17:16:04 +0300 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2022-11-07 13:00:17 +0000 |
commit | d259157bfe473ccb2cff4bdf37aee2e539ccee49 (patch) | |
tree | c6aec5d7dd295a64329d267bb0a4013796c9ea9e /src/libs/installer/packagemanagercore.cpp | |
parent | 19c6d36d03ef2dc55fdd30761ba38968aa12356c (diff) |
InstallerProxy: optimize querying components by name
For some API compatibility with QtScript, the QInstaller::ScriptEngine's
implementation of newQObject(QObject *object) method adds findChild()
and findChildren() functions as properties for the JS object wrapping
the QObject, QInstaller::Component in this case. This results in two
extra QJSEngine::evaluate() calls, adding some overhead. The Component
class does not utilize the QObject's object tree & ownership feature in
the C++ side, so the functions do not add extra value in this context.
InstallerProxy::ComponentByName() creates the JavaScript object of
the component with the aforementioned ScriptEngine::newQObject()
implementation. We inject a snippet resulting in a call to
InstallerProxy's componentByName() function for each component
script. Measuring with callgrind, the time spent in the extra
evaluations was around fifth of the whole evaluation cycle.
Modify the function to to make the addition of the extra properties
optional, and omit them when querying components by name from script.
Task-number: QTIFW-2790
Change-Id: I58040809dcf69599e0fabd98def2dc9464aadf84
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs/installer/packagemanagercore.cpp')
0 files changed, 0 insertions, 0 deletions