ReactiveUI - view locator performance

In my application WPFthat uses ReactiveUI, I noticed a low performance area.

I have a presentation model that contains many other models with easy presentation (think 30ish). These nested view models are simple, usually each one is a button. All of them are displayed inside the user control inside ItemsControl, which is connected using ReactiveUI OneWayBind. This means that each item is displayed using ViewModelViewHost .

So the problem

On my powerful desktop PC, when I switch to this view model, there is a noticeable delay between pressing the go-to-view-model button and changing the view by about 0.5 seconds. When I run the same software on a Power-PC, the delay is about 4 seconds. This is a pretty big problem in terms of UX.

What i learned

I tried profiling and debugging my code for a long time and did not find any problem areas. Zilch (note: using JustMyCode in VS, so ReactiveUI did not appear). However, I found a way to fix the problem. Instead of binding to ItemsControl.ItemSourceusing, OneWayBindI did it in XAML, as such: ItemSource={Binding MyViewModels}and installing it DataTemplatemanually. This leads to a much faster transition.

When you contact OneWayBindwith ItemsControl, it will automatically be created ViewModelViewHostand ViewLocatorused to search for the presentation of your view model. I guess this is very slow for some reason.

Question

Does anyone know how I can get around this performance hit without having to manually define many and many data templates for ItemsControl? If I have model representations, model representations, model representations, then things tend to get ugly very quickly. From my past experiences, Caliburn.Microthe layout conventions were very fast, so I am also wondering if I use correctly ReactiveUIand that there is an alternative approach that is faster.

Thank.

TL; DR;

ViewModelViewHost DataTemplate ~ 30 , - , , . ?

+4
2

, TransitioningContentControl.

( , Silverlight one AFAICT) / .

Unload/Load/Unload , Unload. many .

RxUI WhenActivated , , .

TransitioningContentControl , , , .

+2

.

, /, /.

- , .

, , , , , eyeblink.

, , , .

0

All Articles