How to speed up 'cold start' of .NET component called from VB6 app
I have a VB6 app which brings up a form by invoking a .NET DLL, but the problem is that this form takes almost 5 seconds to appear when the menu item is first selected in the VB6 app is selected. How can I speed this up?
It is only slow for the first time, thereafter it is at an acceptable speed, like it is a native VB6 form.
I'm thinking that one possible solution is to load the Form from the .NET DLL during the splash screen of the VB6 app but make invisible or somehow not show it, and then when the menu item is selected I will make it show or visible.
What are my o开发者_高级运维ptions?
I dont know exactly what the problem is, but i would suggest to first, investigate the problem in more detail using method profiling, to see which method exactly takes so much time.
But my guess would be that the VB6 app needs to load all sorts of .NET Dlls runtime into memory.. which takes all the time, you can do it by loading all of the Dlls when your program start - i think any call to .NET function will cause the dlls to load, so you can just add a simple method inside your form, that doesnt actually do anything, call it during splash screen and it should help..
but again, this is only an educated guess, investigate.. use sysinternals to see which DLLS are being loaded..
I'd guess that it's the fact that you have to load the .Net framework. You could just add a dummy method to your .Net dll that doesn't really do anything and then call that during the splash screen, this way everything should be loaded already.
There are several small thing you can do, changing the framework versions > fx3.5, reduce the size of your assemblies, reduce the number of calls the .net dll makes and running NGEN on the assemblies.
精彩评论