diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-16 10:14:04 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-20 17:14:38 +0200 |
commit | a182897f77eca0f2d4fd7a91145fb805b89e4aa8 (patch) | |
tree | f1f39b0aef18cbb4ac1ebf2883927cce5165c9a9 /src/corelib | |
parent | c6bc549b6bec99241710f38fcc73adc7c1dde9a9 (diff) |
Help the compiler avoid duplicate TLS lookups
Most compilers are clever enough to optimize this out. Yet, even with
optimizations disabled, we don't want to do two TLS lookups here.
Change-Id: I822954c7cec591084d6c27c916818dab7e000ea9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qproperty.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index 9ca290d879..6a129daa7a 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -2318,8 +2318,10 @@ bool isAnyBindingEvaluating() bool isPropertyInBindingWrapper(const QUntypedPropertyData *property) { - return bindingStatus.currentCompatProperty && - bindingStatus.currentCompatProperty->property == property; + // Accessing bindingStatus is expensive because it's thread-local. Do it only once. + if (const auto current = bindingStatus.currentCompatProperty) + return current->property == property; + return false; } namespace BindableWarnings { |