summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-07-10 10:19:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-15 14:41:13 +0200
commit5d0a231b29dfd4d587c7a4d1bbda6a511f94ec77 (patch)
treeebc1d470fd891fe0f9e68a002055c4d3a8dd4884 /chart2
parentdf9ca514d4e9ea87bbf0a96d99181ed8965cd45a (diff)
WhichRangesContainer, reduce malloc in SfxItemSet
SfxItemSet shows up in perf profiles frequently, and the hottest part is the malloc of the two arrays we need. But most of the time, one of those arrays is a compile-time constant. So this change introduces (*) WhichRangesContainer, which manages whether the SfxItemSet owns the array it points at or not. (*) a static const member in svl::Items (idea from mkaganski) to store the data. Change-Id: Icb8cdbc4d54fd76739565c575e16a744515e5355 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118703 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/itemsetwrapper/ItemConverter.cxx12
-rw-r--r--chart2/source/controller/main/ShapeController.cxx2
2 files changed, 6 insertions, 8 deletions
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
index a99d848d0c8c..e90fad016cfd 100644
--- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
@@ -75,20 +75,18 @@ void ItemConverter::_disposing( const lang::EventObject& )
void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
{
- const sal_uInt16 * pRanges = rOutItemSet.GetRanges();
+ const WhichRangesContainer& pRanges = rOutItemSet.GetRanges();
tPropertyNameWithMemberId aProperty;
SfxItemPool & rPool = GetItemPool();
- assert(pRanges != nullptr);
+ assert(!pRanges.empty());
OSL_ASSERT( m_xPropertySetInfo.is());
OSL_ASSERT( m_xPropertySet.is());
- while( (*pRanges) != 0)
+ for(const auto& rPair : pRanges)
{
- sal_uInt16 nBeg = *pRanges;
- ++pRanges;
- sal_uInt16 nEnd = *pRanges;
- ++pRanges;
+ sal_uInt16 nBeg = rPair.first;
+ sal_uInt16 nEnd = rPair.second;
OSL_ASSERT( nBeg <= nEnd );
for( sal_uInt16 nWhich = nBeg; nWhich <= nEnd; ++nWhich )
diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index 8161717fe339..360c2513df18 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -361,7 +361,7 @@ void ShapeController::executeDispatch_TransformDialog()
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
ScopedVclPtr< SfxAbstractTabDialog > pDlg(
pFact->CreateCaptionDialog(pChartWindow, pDrawViewWrapper));
- const sal_uInt16* pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
+ const WhichRangesContainer& pRange = pDlg->GetInputRanges( *aAttr.GetPool() );
SfxItemSet aCombAttr( *aAttr.GetPool(), pRange );
aCombAttr.Put( aAttr );
aCombAttr.Put( aGeoAttr );