diff options
author | Christian Tismer <tismer@stackless.com> | 2020-07-25 00:58:18 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2020-07-31 15:29:12 +0200 |
commit | f2c973af4bd7cc1d87ec8ccfecadb7a475b723da (patch) | |
tree | 7b94124fe5400e56215e3b20c0fbb134a46a8825 /sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | |
parent | edf28c5e97800b0c3442cd5351b6811ec85beead (diff) |
feature-select: optimize feature access to the feasible maximum
** fix: MSVC needs extra sign bit in basewrapper_p.h! Buglet? **
The new feature selection has some tiny overhead.
It is about two dict accesses plus a slot access for every
tp_(get|set)attro call.
The introduction of an explicit `__init_feature__` call allows to
optimize this overhead very nicely, because this init is done for
each __feature__ import:
First, we can remove that tiny overhead completely by not initializing
the feature_select module at all if no __feature__ import is used.
Second, we can optimize this access further by caching the current module
dict. If the dict is unchanged, then the last select_id can be used.
This reduces the overhead of frequent calls to a single slot access.
Third, we finally cache the select id in unused SbkObjectType bits.
That removes the last structure where repeated attribute lookup is used.
The overhead is therefore quite small when something is changed.
But typically these changes are infrequent. The majority of accesses
do change nothing, and this case is now quite much optimized.
Change-Id: I7d1a4611a1c19216fd9be8f04457bb18ebd52ab1
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/PySide2/QtCore/typesystem_core_common.xml')
-rw-r--r-- | sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 1fc0c8d23..62928f3cf 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -673,6 +673,10 @@ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-qflag"/> </add-function> + <add-function signature="__init_feature__()"> + <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-init-feature"/> + </add-function> + <add-function signature="qAbs(double)" return-type="double"> <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-qabs"/> </add-function> |