sc/source/core/data/global.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
New commits: commit bb50b1609abe83265311613db4a18e992dc666c8 Author: Eike Rathke <er...@redhat.com> Date: Mon Nov 14 23:28:37 2016 +0100 sc-perf: HasAttrChanged: save unnecessary calls to SfxItemPool::Get() SfxItemPool::GetItemState() can already return a pointer to a set item so that doesn't need to be obtained again through SfxItemPool::Get() tdf#103493 'LotroPlan 3.8.ods' https://bugs.documentfoundation.org/attachment.cgi?id=128252 Incl. Self Called Before: 10,210,820,257 1,162,295,513 34,670,201 After: 9,887,701,235 1,384,985,151 34,670,201 Only ~3% and 0.5% of the overall load time, but.. Change-Id: Icbed8a7982a27472fdfb1dbe4fd2061ab1e601bd diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 1436ecf..50c5ba4 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -141,29 +141,29 @@ bool ScGlobal::HasAttrChanged( const SfxItemSet& rNewAttrs, const sal_uInt16 nWhich ) { bool bInvalidate = false; - const SfxItemState eNewState = rNewAttrs.GetItemState( nWhich ); - const SfxItemState eOldState = rOldAttrs.GetItemState( nWhich ); + const SfxPoolItem* pNewItem = nullptr; + const SfxItemState eNewState = rNewAttrs.GetItemState( nWhich, true, &pNewItem ); + const SfxPoolItem* pOldItem = nullptr; + const SfxItemState eOldState = rOldAttrs.GetItemState( nWhich, true, &pOldItem ); if ( eNewState == eOldState ) { // Both Items set // PoolItems, meaning comparing pointers is valid if ( SfxItemState::SET == eOldState ) - bInvalidate = (&rNewAttrs.Get( nWhich ) != &rOldAttrs.Get( nWhich )); + bInvalidate = (pNewItem != pOldItem); } else { // Contains a Default Item // PoolItems, meaning Item comparison necessary - const SfxPoolItem& rOldItem = ( SfxItemState::SET == eOldState ) - ? rOldAttrs.Get( nWhich ) - : rOldAttrs.GetPool()->GetDefaultItem( nWhich ); + if (!pOldItem) + pOldItem = &rOldAttrs.GetPool()->GetDefaultItem( nWhich ); - const SfxPoolItem& rNewItem = ( SfxItemState::SET == eNewState ) - ? rNewAttrs.Get( nWhich ) - : rNewAttrs.GetPool()->GetDefaultItem( nWhich ); + if (!pNewItem) + pNewItem = &rNewAttrs.GetPool()->GetDefaultItem( nWhich ); - bInvalidate = rNewItem != rOldItem; + bInvalidate = (*pNewItem != *pOldItem); } return bInvalidate; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits