svl/source/items/itemset.cxx | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
New commits: commit 7f6fbed9f195078ed63760f1206a328f38571ba8 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu May 26 12:47:29 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu May 26 15:43:56 2022 +0200 ofz#24932-1 walk ItemSets together in SfxItemSet::Set shaves 20% off the time of ./instdir/program/soffice.bin --calc --convert-to pdf ~/Downloads/ofz24932-1.rtf Change-Id: I85c8bdd51895d768c37d247f6bf07ce9183d1107 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135014 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 7953cd922363..2d90ab16eac7 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -707,14 +707,29 @@ bool SfxItemSet::Set ClearItem(); if ( bDeep ) { - SfxWhichIter aIter(*this); - sal_uInt16 nWhich = aIter.FirstWhich(); - while ( nWhich ) + SfxWhichIter aIter1(*this); + SfxWhichIter aIter2(rSet); + sal_uInt16 nWhich1 = aIter1.FirstWhich(); + sal_uInt16 nWhich2 = aIter2.FirstWhich(); + for (;;) { + if (!nWhich1 || !nWhich2) + break; + if (nWhich1 > nWhich2) + { + nWhich2 = aIter2.NextWhich(); + continue; + } + if (nWhich1 < nWhich2) + { + nWhich1 = aIter1.NextWhich(); + continue; + } const SfxPoolItem* pItem; - if( SfxItemState::SET == rSet.GetItemState( nWhich, true, &pItem ) ) + if( SfxItemState::SET == rSet.GetItemState( nWhich1, true, &pItem ) ) bRet |= nullptr != Put( *pItem, pItem->Which() ); - nWhich = aIter.NextWhich(); + nWhich1 = aIter1.NextWhich(); + nWhich2 = aIter2.NextWhich(); } } else