Le 09/03/2025 à 18:23, Jean-Marc Lasgouttes a écrit :
I do not have much time right now, but hotspot thinks that the time is spent in BulletsModule constructor.

This code uses svg images since the commit below. Would it be faster with one big svg for each type of bullets ?

With 2.5, this is dwarfed by ColorCombo, but that is a different story.

Using pmprof on master with the attached patch, one sees indeed that bullets and colors use 94% of GuiDocument creation time.

#pmprof# bulletsModule: 432.70 ms, count=1, total=432.70 ms
#pmprof# colorModule: 884.27 ms, count=1, total=884.27 ms
#pmprof# GuiDocument: 1.40 s, count=1, total=1.40 s

What is strange though is that the dialog seems to need more than 1.4 seconds to appear, but this is subjective.

Note that the ColorsCombo thing also costs time in other places, the total cost of fillComboColor is 1.24 seconds in 21 calls.

JMarc

diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 30f692804c..57a3f33160 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -69,6 +69,7 @@
 #include "support/lstrings.h"
 #include "support/Package.h"
 #include "support/TempFile.h"
+#include "support/pmprof.h"
 
 #include "frontends/alert.h"
 
@@ -806,6 +807,7 @@ GuiDocument::GuiDocument(GuiView & lv)
 	  modulesChanged_(false), shellescapeChanged_(false),
 	  switchback_(false)
 {
+	PROFILE_THIS_BLOCK(GuiDocument);
 	setupUi(this);
 
 	connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
@@ -1348,7 +1350,7 @@ GuiDocument::GuiDocument(GuiView & lv)
 	bc().addCheckedLineEditPanel(marginsModule->columnsepLE,
 				     docPS, N_("Page Margins"));
 
-
+	{PROFILE_THIS_BLOCK(colorModule);
 	// color
 	colorModule = new UiWidget<Ui::ColorUi>(this);
 	connect(colorModule->textColorCO, SIGNAL(activated(int)),
@@ -1397,7 +1399,7 @@ GuiDocument::GuiDocument(GuiView & lv)
 	colorModule->customColorsTW->setToolTip(qt_("Double-click on an item to change its color"));
 	QRegularExpression ascii_re("[A-Za-z0-9]+");
 	colorModule->newColorLE->setValidator(new QRegularExpressionValidator(ascii_re, colorModule->newColorLE));
-
+	}
 
 	// change tracking
 	changesModule = new UiWidget<Ui::ChangeTrackingUi>(this);
@@ -1729,12 +1731,12 @@ GuiDocument::GuiDocument(GuiView & lv)
 	connect(localLayout, SIGNAL(changed()),
 		this, SLOT(change_adaptor()));
 
-
+	{PROFILE_THIS_BLOCK(bulletsModule);
 	// bullets
 	bulletsModule = new BulletsModule(this);
 	connect(bulletsModule, SIGNAL(changed()),
 		this, SLOT(change_adaptor()));
-
+	}
 
 	// Modules
 	modulesModule = new UiWidget<Ui::ModulesUi>(this);
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to