There are two vb6 applications that I work with. One of them starts up very quickly whereas the other one takes quite a long time. I thought I would do a little analysis to find out why the one takes so long.
So I hit F8 to start at the beginning and I realize that a significant portion of that startup time is actually between the time I hit F8 and the time it highlights the very first line of code.
Which of the following is most likely causing this?
And as a bonus, I would love any ideas on how to more specifically pinpoint the problem if it could be in multiple areas.
Thanks!
Edit: It seems I may have not been clear enough on exactly 'where' the slowdown is occurring. So to make it clear I created the following procedure:
Sub Main()
End Sub
That's it, and it's in a module that contains absolutely nothing besides these two lines. No forms are getting loaded, and while there are other modules with "Dim o as New SomeObject", I know those objects aren't getting instantiated because I know that visual basic doesn't create objects declared this way until you actually use them for the first time.
I believe I have now optimized the startup code as much as is technically possible. Yet it still takes the same amount of time to startup.
Edit 2: I just realized that the compiled application actually starts up reasonably fast. It's just starting it in the ide that takes so long. However, I care a lot more about the speed for me than I do the customer cause they just start it once and leave it running all day whereas I start it a couple dozen times a day.
That time is probably spent initializing all the objects on the startup form. Do you have a lot of COM objects or UserControls on the startup form? They may, in turn, load other objects that they are using.
The best way to debug this is to remove one object at a time (don't worry about built-in controls, just worry about external objects) from the startup form until you figure out which one is taking the most time at startup. You can then try to speed up the launch time by optimizing the startup code in that object, or at least by deferring the creation of that object until it's actually needed.
How big is the project? It's probably doing an intermediate compile to p-code so it can run it. You may be able to tweak this using the Compile settings in the Options dialog.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With