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?
- Number of dependencies
- Having too many projects in the group project instead of referencing them as dlls
- Number of forms
- Number of objects in the startup form
- Number of objects on all forms
- What else?
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.
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.