[LyX features/biginset] Remove some redundant calls to updatePosCache

Jean-Marc Lasgouttes lasgouttes at lyx.org
Mon Jul 24 12:29:05 UTC 2023


The branch, biginset, has been updated.

- Log -----------------------------------------------------------------

commit 9ff6d09d1f42f5e30fa59b18c5b9e7975018618b
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Mon Jul 24 15:35:16 2023 +0200

    Remove some redundant calls to updatePosCache
    
    The setting of insets positions was done twice in updateMetrics.
    When one of the paragraph is a huge branch, this can be very expensive.
    
    This leads to a 17% improvement on updateMetrics time on a scrolling test.
    
    Part of bug #12297

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 0ffedf4..2ddbcd9 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -3126,7 +3126,6 @@ void BufferView::updateMetrics(Update::flags & update_flags)
 		}
 	}
 	anchor_pm.setPosition(d->anchor_ypos_);
-	tm.updatePosCache(d->anchor_pit_);
 
 	LYXERR(Debug::PAINTING, "metrics: "
 		<< " anchor pit = " << d->anchor_pit_
@@ -3142,7 +3141,6 @@ void BufferView::updateMetrics(Update::flags & update_flags)
 		y1 -= pm.descent();
 		// Save the paragraph position in the cache.
 		pm.setPosition(y1);
-		tm.updatePosCache(pit1);
 		y1 -= pm.ascent();
 	}
 
@@ -3156,7 +3154,6 @@ void BufferView::updateMetrics(Update::flags & update_flags)
 		y2 += pm.ascent();
 		// Save the paragraph position in the cache.
 		pm.setPosition(y2);
-		tm.updatePosCache(pit2);
 		y2 += pm.descent();
 	}
 

commit 2cb980080ca9245a7684c002b03ca3adf89f7861
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Mon Jul 24 15:11:20 2023 +0200

    Add instrumentation for profiling

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 80a6b80..0ffedf4 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -77,6 +77,8 @@
 #include "support/Length.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
+//#define DISABLE_PMPROF
+#include "support/pmprof.h"
 #include "support/types.h"
 
 #include <algorithm>
@@ -3081,6 +3083,7 @@ void BufferView::updateMetrics()
 
 void BufferView::updateMetrics(Update::flags & update_flags)
 {
+	PROFILE_THIS_BLOCK(updateMetrics);
 	if (height_ == 0 || width_ == 0)
 		return;
 

-----------------------------------------------------------------------

Summary of changes:
 src/BufferView.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list