svx/source/unodraw/unoshape.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 526f0fce45fb014b09057403ae37c125e5a18655
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Apr 9 12:05:16 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Apr 10 15:34:22 2021 +0200

    tdf#130326 speed up opening XLSX
    
    SvxShape::Notify is called a lot (26%) of CPU, so re-arrange it
    to do the cheapest checks first.
    
    Change-Id: I0e6c6c976ecfe7670e8d4af175606654f839aa66
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113843
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 1e5263921fd2..de292ef43bb3 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -992,16 +992,18 @@ uno::Sequence< sal_Int8 > SAL_CALL 
SvxShape::getImplementationId()
 void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
 {
     DBG_TESTSOLARMUTEX();
-    if( !HasSdrObject() )
-        return;
 
-    // #i55919# SdrHintKind::ObjectChange is only interesting if it's for this 
object
+    // do cheap checks first, this method is hot
     if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
         return;
-    SdrObject* pSdrObject(GetSdrObject());
     const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
-    if ((pSdrHint->GetKind() != SdrHintKind::ModelCleared) &&
-         (pSdrHint->GetKind() != SdrHintKind::ObjectChange || 
pSdrHint->GetObject() != pSdrObject ))
+    if (pSdrHint->GetKind() != SdrHintKind::ModelCleared &&
+        pSdrHint->GetKind() != SdrHintKind::ObjectChange)
+        return;
+
+    // #i55919# SdrHintKind::ObjectChange is only interesting if it's for this 
object
+    SdrObject* pSdrObject(GetSdrObject());
+    if ( !pSdrObject || pSdrHint->GetObject() != pSdrObject )
         return;
 
     uno::Reference< uno::XInterface > xSelf( pSdrObject->getWeakUnoShape() );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to