diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-26 12:47:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-26 15:43:56 +0200 |
commit | 7f6fbed9f195078ed63760f1206a328f38571ba8 (patch) | |
tree | 1ba54f4d2f0fd1b62de41a86c89bbf16b3d7545f /svl | |
parent | c80c5ae7089e0e288c2f4ef9a9af5079f020c54f (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/itemset.cxx | 25 |
1 files changed, 20 insertions, 5 deletions
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 |