Skip to content

Commit

Permalink
Performance: Initialize ToolPanes in DockWorkspace.InitializeLayout()…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
siegfriedpammer committed Dec 14, 2024
1 parent 62cdf38 commit 663dea4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ILSpy/Docking/DockWorkspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,9 @@ public void AddTabPage(TabPageModel tabPage = null)

public ReadOnlyObservableCollection<TabPageModel> TabPages { get; }

public ReadOnlyCollection<ToolPaneModel> ToolPanes => exportProvider
.GetExportedValues<ToolPaneModel>("ToolPane")
.OrderBy(item => item.Title)
.ToArray()
.AsReadOnly();
private ToolPaneModel[] toolPanes = [];

public ReadOnlyCollection<ToolPaneModel> ToolPanes => toolPanes.AsReadOnly();

public bool ShowToolPane(string contentId)
{
Expand Down Expand Up @@ -183,6 +181,12 @@ public void InitializeLayout()
AddTabPage();
}

toolPanes = exportProvider
.GetExportedValues<ToolPaneModel>("ToolPane")
.OrderBy(item => item.Title)
.ToArray();
OnPropertyChanged(nameof(ToolPanes));

DockingManager.LayoutUpdateStrategy = this;
XmlLayoutSerializer serializer = new XmlLayoutSerializer(DockingManager);
serializer.LayoutSerializationCallback += LayoutSerializationCallback;
Expand Down

0 comments on commit 663dea4

Please sign in to comment.