From f2c973af4bd7cc1d87ec8ccfecadb7a475b723da Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sat, 25 Jul 2020 00:58:18 +0200 Subject: 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 --- sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sources/pyside2/PySide2/QtCore/typesystem_core_common.xml') 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 @@ + + + + -- cgit v1.2.3