Performance issue in Prism 4

Topics: Prism v4 - WPF 4
Aug 17, 2013 at 2:31 PM
Edited Aug 17, 2013 at 2:34 PM

I am using prism 4.1 with MEF in my application. Everything works well but we have big performance issue each time when we load a MDI module thru menu in the Shell app, below is the main layout of my WPF application with Prism:

Shell module: it will load MDI views thru contentcontrol from MDI module A1,A2,An,etc. on-demand via MDI region adapter written by myself.

MDI Module A1,A2,A3,etc.: it will load 2-3 shared views(using contentcontrol) that are included in the Shared modules via Regions.RequestNavigate API.

Shared Module S1,S2,S3,etc.

Each module has a couple of views and corresponding viewmodels.

After testing we found that it took about 4 seconds to show each MDI view. It took about 1 second for viewmodels to retrieve data from database, that means it took 3 seconds to show the MDI views. Currently each MDI view only have 1 tabitem that includes 3 shared views, it should be a terrible thing if i add more tabitem in each MDI view if any of them will take 3 seconds.

How to solve the performance issues when using Prism? Could someone help me out on this? Any input wll be much appreciated.
Aug 20, 2013 at 3:32 PM

You mentioned that each MDI view (which takes 4 seconds to load) is composed of a TabItem which contains other 3 views. Does each of this views have a view model that retrieves data from a database? If so, the measurement of 1 second is the total time required to retrieve the information for the three view models, or for a single one. Are those request to the data base being executed parallel to each other or sequentially? (for example, the thread is blocked until the request comes back from the data base.) I'm asking these questions mainly to have a better understanding of the composition of your MDI views and in order to discard the communication with the data base as the cause of the problem.

Other tests you could do to track down the cause behind the delay include adding more views to the MDI view and check if the time required to show the view increases. Also, you could try using mock data in your view models, instead of retrieving data from the data base to check if this have any influence in the loading time of the view.


Damian Cherubini