Performance: Slow performance for some plot and curve operations

* Performance: Cache registry value
* Performance: Avoid recursive update
Early return if values are identical
updateConnectedEditors is handled by setValueFromUiEditor
Avoid fieldChanged in analyzePlotsAndAdjustAppearanceSettings
This commit is contained in:
Magne Sjaastad 2023-08-25 10:39:19 +02:00 committed by GitHub
parent d198dc8537
commit 3800246b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 13 deletions

View File

@ -209,8 +209,14 @@ const char* RiaApplication::getVersionStringApp( bool includeCrtInfo )
//--------------------------------------------------------------------------------------------------
bool RiaApplication::enableDevelopmentFeatures()
{
QString environmentVar = QProcessEnvironment::systemEnvironment().value( "RESINSIGHT_DEVEL", QString( "0" ) );
return environmentVar.toInt() == 1;
static int envValue = -999;
if ( envValue == -999 )
{
QString environmentVar = QProcessEnvironment::systemEnvironment().value( "RESINSIGHT_DEVEL", QString( "0" ) );
envValue = environmentVar.toInt();
}
return envValue == 1;
}
//--------------------------------------------------------------------------------------------------

View File

@ -648,11 +648,11 @@ void RimPlotAxisProperties::setMajorTickmarkCount( LegendTickmarkCount count )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisProperties::setAutoValueForMajorTickmarkCount( LegendTickmarkCount count )
void RimPlotAxisProperties::setAutoValueForMajorTickmarkCount( LegendTickmarkCount count, bool notifyFieldChanged )
{
auto enumValue = static_cast<std::underlying_type_t<LegendTickmarkCount>>( count );
m_majorTickmarkCount.uiCapability()->setAutoValue( enumValue );
m_majorTickmarkCount.uiCapability()->setAutoValue( enumValue, notifyFieldChanged );
}
//--------------------------------------------------------------------------------------------------

View File

@ -123,7 +123,7 @@ public:
LegendTickmarkCount majorTickmarkCount() const override;
void setMajorTickmarkCount( LegendTickmarkCount count ) override;
void setAutoValueForMajorTickmarkCount( LegendTickmarkCount count );
void setAutoValueForMajorTickmarkCount( LegendTickmarkCount count, bool notifyFieldChanged );
void enableAutoValueForMajorTickmarkCount( bool enable );
void enableAutoValueForAllFields( bool enable );

View File

@ -1269,6 +1269,8 @@ void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings()
bool canShowOneAxisTitlePerRow = analyzer.isSingleQuantityIgnoreHistory() && ( m_axisRangeAggregation() != AxisRangeAggregation::NONE );
const bool notifyFieldChanged = false;
for ( auto p : summaryPlots() )
{
auto timeAxisProp = p->timeAxisProperties();
@ -1276,7 +1278,7 @@ void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings()
auto tickMarkCount = ( columnCount() < 3 ) ? RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_DEFAULT
: RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_FEW;
timeAxisProp->setAutoValueForMajorTickmarkCount( tickMarkCount );
timeAxisProp->setAutoValueForMajorTickmarkCount( tickMarkCount, notifyFieldChanged );
for ( auto* axisProp : p->plotYAxes() )
{
@ -1285,7 +1287,7 @@ void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings()
auto tickMarkCount = ( rowsPerPage() == 1 ) ? RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_DEFAULT
: RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_FEW;
axisProp->setAutoValueForMajorTickmarkCount( tickMarkCount );
axisProp->setAutoValueForMajorTickmarkCount( tickMarkCount, notifyFieldChanged );
axisProp->computeAndSetAutoValueForScaleFactor();

View File

@ -1924,8 +1924,6 @@ void RimSummaryPlot::updateZoomFromParentPlot()
axisProperties->setVisibleRangeMax( axisMax );
axisProperties->setVisibleRangeMin( axisMin );
axisProperties->updateConnectedEditors();
}
}

View File

@ -553,11 +553,11 @@ void RimSummaryTimeAxisProperties::setMajorTickmarkCount( LegendTickmarkCount co
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryTimeAxisProperties::setAutoValueForMajorTickmarkCount( LegendTickmarkCount count )
void RimSummaryTimeAxisProperties::setAutoValueForMajorTickmarkCount( LegendTickmarkCount count, bool notifyFieldChanged )
{
auto enumValue = static_cast<std::underlying_type_t<LegendTickmarkCount>>( count );
m_majorTickmarkCount.uiCapability()->setAutoValue( enumValue );
m_majorTickmarkCount.uiCapability()->setAutoValue( enumValue, notifyFieldChanged );
}
//--------------------------------------------------------------------------------------------------

View File

@ -135,7 +135,7 @@ public:
LegendTickmarkCount majorTickmarkCount() const override;
void setMajorTickmarkCount( LegendTickmarkCount count ) override;
void setAutoValueForMajorTickmarkCount( LegendTickmarkCount count );
void setAutoValueForMajorTickmarkCount( LegendTickmarkCount count, bool notifyFieldChanged );
void enableAutoValueForMajorTickmarkCount( bool enable );
const QString objectName() const override;

View File

@ -140,6 +140,8 @@ void PdmUiFieldHandle::enableAndSetAutoValue( const QVariant& autoValue )
//--------------------------------------------------------------------------------------------------
void PdmUiFieldHandle::setAutoValue( const QVariant& autoValue, bool notifyFieldChanged )
{
if ( m_autoValue == autoValue ) return;
m_autoValue = autoValue;
applyAutoValueAndUpdateEditors( notifyFieldChanged );
@ -257,7 +259,6 @@ void PdmUiFieldHandle::applyAutoValueAndUpdateEditors( bool notifyFieldChanged )
if ( m_useAutoValue && m_autoValue.isValid() )
{
setValueFromUiEditor( m_autoValue, notifyFieldChanged );
updateConnectedEditors();
}
}