Speed up startup by skipping repeated refreshes and building the UV editor on first use (#16930)

Startup to the main window is about 280 ms faster with 24 filaments and about 170 ms faster with 4 (Windows, Bambu H2S, median of 4 runs).

- Filament lists are refreshed once per config change instead of once for each of `filament_colour`, `filament_type` and `filament_is_support`.
- The UV editor pane is built the first time it is shown, through `Lazy<T>`, and keeps its saved dock position when it was not built in a session.
- The SLA import dialog is built on first use, through `Lazy<T>`.
- The sidebar and main window are no longer frozen while the window is hidden.
- The filament combos are not filled before the main window is shown. The printer tab fills them once while presets load.
- The object settings refresh is skipped until the main window is shown, when no object can be selected yet.
This commit is contained in:
yw4z authored and GitHub committed 2026-11-02 18:12:53 -06:00
1 parent 896557bce5
commit e2acd9ec06
6 files changed
+126 -67

No files matched your search

+6 -2
View File
@@ -159,6 +159,7 @@
#include <cassert>
#include <wx/display.h>
#include <wx/window.h>
#include <wx/wupdlock.h>
using json = nlohmann::json;
@@ -1214,7 +1215,11 @@ void MainFrame::update_layout()
wxBusyCursor busy;
Freeze();
// While the main frame is being created nothing is on screen, and a freeze would only walk
// every child window to block redraws that cannot happen.
wxWindowUpdateLocker no_updates;
if (IsShownOnScreen())
no_updates.Lock(this);
// Remove old settings
if (m_layout != ESettingsLayout::Unknown)
@@ -1306,7 +1311,6 @@ void MainFrame::update_layout()
#endif
Layout();
Thaw();
}
#ifdef __WXGTK__