Skip to content

Commit 663dea4

Browse files
Performance: Initialize ToolPanes in DockWorkspace.InitializeLayout() instead of the property getter to avoid WPF seeing them in InitializeComponent() and rendering all panes docked at the right before the layout is properly initialized. This also appears to make startup around 500ms/25% faster, keeping total time from App::.cctor to "decompilation finished" (for a "standard" assembly node with just attributes in the output) at under two seconds.
1 parent 62cdf38 commit 663dea4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ILSpy/Docking/DockWorkspace.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,9 @@ public void AddTabPage(TabPageModel tabPage = null)
123123

124124
public ReadOnlyObservableCollection<TabPageModel> TabPages { get; }
125125

126-
public ReadOnlyCollection<ToolPaneModel> ToolPanes => exportProvider
127-
.GetExportedValues<ToolPaneModel>("ToolPane")
128-
.OrderBy(item => item.Title)
129-
.ToArray()
130-
.AsReadOnly();
126+
private ToolPaneModel[] toolPanes = [];
127+
128+
public ReadOnlyCollection<ToolPaneModel> ToolPanes => toolPanes.AsReadOnly();
131129

132130
public bool ShowToolPane(string contentId)
133131
{
@@ -183,6 +181,12 @@ public void InitializeLayout()
183181
AddTabPage();
184182
}
185183

184+
toolPanes = exportProvider
185+
.GetExportedValues<ToolPaneModel>("ToolPane")
186+
.OrderBy(item => item.Title)
187+
.ToArray();
188+
OnPropertyChanged(nameof(ToolPanes));
189+
186190
DockingManager.LayoutUpdateStrategy = this;
187191
XmlLayoutSerializer serializer = new XmlLayoutSerializer(DockingManager);
188192
serializer.LayoutSerializationCallback += LayoutSerializationCallback;

0 commit comments

Comments
 (0)