Little delay for view creation

Topics: Prism v4 - WPF 4
Jan 11, 2012 at 3:52 PM

Hi,

In my application, i'm using 2 modules that contains a Telerik grid. Each module is displayed in the main region when user clics on a button. I've noticed that the first time the view is loaded, it take some time (near 2 or 3 seconds) and then, when i re-navigate to this view, the view is loaded immediately.

I've tried to pre-load (using Assembly.Load) all the DLLs of Telerik, to prevent my application to lad them when the module is loaded. The view is now displayed in1 or 2 second but i wonder why it take so much time ?

I've also tried to remove the telerik component of the module and load them: it still takes 2 seconds to load and display the view (that contains only 1 textbox) contains in my module.

Is it a normal behavior ? What can i do to improve the time needed to display my view the first time ?

 

Thanks !

Developer
Jan 11, 2012 at 6:58 PM

Hi,

If your modules are being loaded on demand, it might be possible (depending of the environment in which your application is running) to experience a little time delay as the modules need to be loaded and then initialized before the view is added to the region. Also, if your module has a reference to some heavy resources (like .dll files), the load time of the module might be higher as those files need to be loaded too.

If this is not the case, it would be helpful if you could provide us with a repro-sample application portraying this problem so we can help you find the cause of this delay you are describing.

I hope you find this useful,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Jan 12, 2012 at 7:18 AM
DCherubini wrote:

Hi,

If your modules are being loaded on demand, it might be possible (depending of the environment in which your application is running) to experience a little time delay as the modules need to be loaded and then initialized before the view is added to the region. Also, if your module has a reference to some heavy resources (like .dll files), the load time of the module might be higher as those files need to be loaded too.

If this is not the case, it would be helpful if you could provide us with a repro-sample application portraying this problem so we can help you find the cause of this delay you are describing.

I hope you find this useful,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Hi,

No, my modules are no longer loaded on demand, they are all loaded at startup. Yes, as we use Telerik for graphic components, my modules has a reference to some heavy resources

=> Thus, i would like to know if they are some way to decrease the load time ? Is there a way to pre-load all the resources ? As explained before, during startup of my application, i've tried to pre-load all the resources files (using Assembly.Load): now, in Visual Studio, i don't see the resources to be loaded when the view in my module is displayed (as i've pre-load them) but the view still take some times to be displayed the first time. Maybe there are something particular to pre-load the assemblies/resources ?

 

Thanks !

 

PS: Unfortunately, i'm unable to send a repro-sample now (as it's a issue on our "big" application)

Developer
Jan 12, 2012 at 4:56 PM
Edited Jan 12, 2012 at 4:58 PM

Hi,

So far, based on the information provided, we couldn't find any problem with the approach you are following.

If you have confirmed that the weight of your view is not the problem, I believe you could check if this is not related to the construction of the view model class of your view, which may involve your application's business logic and data.

On the other hand, you might find the following discussion useful, where a similar issue is addressed:

Also I believe you could find these articles interesting:

I hope you find this handy,

Agustin Adami
http://blogs.southworks.net/aadami


Jan 12, 2012 at 9:16 PM
aadami wrote:

If you have confirmed that the weight of your view is not the problem

Maybe i need to check that: how can i confirm this issue ?

aadami wrote:

On the other hand, you might find the following discussion useful, where a similar issue is addressed:

Also I believe you could find these articles interesting:

I'll take a look at this too, thanks !

Developer
Jan 13, 2012 at 5:03 PM
Edited Jan 13, 2012 at 5:04 PM

Hi,

Based on your comments, I believe it's safe to say that the weight of the view is not the problem. As you mentioned before, when showing the view with only one TextBox the problem remains.

On the other hand, to check if your problem is caused by the construction of your view model, you could try removing the association of the view with the corresponding view model, and check if the problem continues.

Regards,

Agustin Adami
http://blogs.southworks.net/aadami


Jan 13, 2012 at 10:16 PM

Hi,

We have already try to remove the construction of the ViewModel but this does not change anything... The problem is still there :(

Developer
Jan 16, 2012 at 5:06 PM

Hi,

So far, with the information provided, we were unable to find the reason behind this problem. At this point, it would be helpful if you could provide us with a repro-sample application portraying this scenario so we could help you further with this. If you find this problem too difficult to reproduce in a clean solution, you could, for example, make a copy of your application and start removing parts of it (for example, business logic, models, etc) in order to keep only the necessary elements required to reproduce this scenario.

Regards,

Damian Cherubini
http://blogs.southworks.net/dcherubini