AvalonDock 2.0 - Apparent improvement to performance

Aug 29, 2012 at 3:40 PM
Edited Aug 29, 2012 at 3:41 PM

Our QA was complaining that when changing between layouts the loading was taking too long.  In investigating the issue I found that overall the performance was pretty good and within requirements except when there was a floating window.  After digging into the code it turns out that the problem was the FloatingWindow.Show().  Showing the floating window could take between two and three seconds and was consistently the only place there was a significant slowdown.  Knowing that this was a standard Window.Show() I understood there was nothing Ado could do about it.

To combat this I modified the DockingMananger.CreateUIElementForModel(ILayoutElement model) such that in both the 

if (model is LayoutDocumentFloatingWindow)

and the

if (model is LayoutAnchorableFloatingWindow)

I changed the newFW.Show() to

Dispatcher.BeginInvoke(new Action(() => 


allowing the UI thread to schedule the Show when it can get around to it.

Again, I call this an "apparent improvement to performance" because as we all know this doesn't really change the performance in any way.  It's still the UI thread that has to show the window, it just off-loads the show to later but this gives the user the impression that the layout loads faster.

As always YMMV but it helped me.