From d555425ff8503a793d9d42372ce78fa0530a670d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 26 Nov 2020 14:13:43 +0100 Subject: Inline the fast path for removeBinding() Save a function call in the common case where we don't have a binding This makes a rather large performance difference for setters that do not have a binding. Change-Id: I140f29790f6fe868721a33b9fad37205e547b8e9 Reviewed-by: Fabian Kosmale (cherry picked from commit c63901c5f3195596eb81e5f5ae5483ca5a0b6d35) Reviewed-by: Ulf Hermann --- src/corelib/kernel/qpropertyprivate.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/corelib/kernel/qpropertyprivate.h') diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index 69e88b599f..f4b81ea40b 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -248,7 +248,11 @@ public: } void evaluateIfDirty(const QUntypedPropertyData *property) const; - void removeBinding(); + void removeBinding() + { + if (hasBinding()) + removeBinding_helper(); + } void registerWithCurrentlyEvaluatingBinding(QtPrivate::BindingEvaluationState *currentBinding) const { @@ -257,8 +261,10 @@ public: registerWithCurrentlyEvaluatingBinding_helper(currentBinding); } void registerWithCurrentlyEvaluatingBinding() const; - void registerWithCurrentlyEvaluatingBinding_helper(BindingEvaluationState *currentBinding) const; void notifyObservers(QUntypedPropertyData *propertyDataPtr) const; +private: + void registerWithCurrentlyEvaluatingBinding_helper(BindingEvaluationState *currentBinding) const; + void removeBinding_helper(); }; template -- cgit v1.2.3