[LyX/2.4.1-devel] Remove some redundant calls to updatePosCache

Jean-Marc Lasgouttes lasgouttes at lyx.org
Thu Apr 18 16:21:38 UTC 2024


commit e51f9d9f885bdf76ba6a20671d0f730d6be87483
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
    
    (cherry picked from commit d19ade9a611d3ecf6840c5eb43291cb268ad6f4f)
---
 src/BufferView.cpp | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 4065a464b6..27ad1ad8f2 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -3216,7 +3216,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_
@@ -3232,7 +3231,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();
 	}
 
@@ -3246,7 +3244,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();
 	}
 


More information about the lyx-cvs mailing list