Get rid of one call into the TLS when evaluating bindings
Store a pointer to the TLS in the BingingEvaluationState. Like this, we can save us one TLS lookup in the destructor. Shaves off a couple of percent during binding evaluation. Change-Id: Idc9dc5b0ea202aaeb68cdc063700b8e4968753dc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>bb10
parent
1718948ed4
commit
b038575a89
|
|
@ -193,14 +193,17 @@ static thread_local BindingEvaluationState *currentBindingEvaluationState = null
|
|||
BindingEvaluationState::BindingEvaluationState(QPropertyBindingPrivate *binding)
|
||||
: binding(binding)
|
||||
{
|
||||
previousState = currentBindingEvaluationState;
|
||||
currentBindingEvaluationState = this;
|
||||
// store a pointer to the currentBindingEvaluationState to avoid a TLS lookup in
|
||||
// the destructor (as these come with a non zero cost)
|
||||
currentState = ¤tBindingEvaluationState;
|
||||
previousState = *currentState;
|
||||
*currentState = this;
|
||||
binding->clearDependencyObservers();
|
||||
}
|
||||
|
||||
BindingEvaluationState::~BindingEvaluationState()
|
||||
{
|
||||
currentBindingEvaluationState = previousState;
|
||||
*currentState = previousState;
|
||||
}
|
||||
|
||||
void QPropertyBase::evaluateIfDirty()
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ struct BindingEvaluationState
|
|||
~BindingEvaluationState();
|
||||
QPropertyBindingPrivate *binding;
|
||||
BindingEvaluationState *previousState = nullptr;
|
||||
BindingEvaluationState **currentState = nullptr;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
Loading…
Reference in New Issue