[LyX features/biginset] Do not compute metrics at each preview when loading file

Jean-Marc Lasgouttes lasgouttes at lyx.org
Thu Dec 21 15:47:23 UTC 2023


The branch, biginset, has been updated.

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

commit 724abcf97cad9d59cc5fed8e86c927c6c7473191
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Thu Dec 21 16:33:06 2023 +0100

    Do not compute metrics at each preview when loading file
    
    With the branch-test.lyx file from #12297, loading takes forever when
    previews are activated. This is because each preview element causes a
    full screen metrics recomputation.
    
    This commit just skips these calls and only does one when all previews
    have been obtained. As a result, computing the previews takes 1 second
    instead of 25 seconds on branch-test.lyx.
    
    Part of bug #12297.

diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp
index a350a49..aec8b1e 100644
--- a/src/graphics/PreviewLoader.cpp
+++ b/src/graphics/PreviewLoader.cpp
@@ -786,6 +786,16 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval)
 	// Remove the item from the list of still-executing processes.
 	in_progress_.erase(git);
 
+#if 0
+	/* FIXME : there is no need for all these calls, which recompute
+	 * all metrics for each and every preview. The single call at the
+	 * end of this method is sufficient.
+
+	 * It seems that this whole imageReady mechanism is actually not
+	 * needed. If it is the case, the whole updateFrontend/updateInset
+	 * bloat can go too.
+	 */
+
 	// Tell the outside world
 	list<PreviewImagePtr>::const_reverse_iterator
 		nit  = newimages.rbegin();
@@ -794,6 +804,8 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval)
 	for (; nit != nend; ++nit) {
 		imageReady(*nit->get());
 	}
+#endif
+
 	finished_generating_ = true;
 	buffer_.scheduleRedrawWorkAreas();
 }

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

Summary of changes:
 src/graphics/PreviewLoader.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list