Results 1 to 7 of 7

Thread: Windows Program - form constructor and load taking "a long time"

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,475

    Windows Program - form constructor and load taking "a long time"

    My users have been complaining that it's taking up to 5 seconds to load a form. I started to look into this and yes, from the top of the constructor to the last instruction I timed it at 3.4 seconds. Then the form load from top to bottom is 2.5 seconds. So that is definitely a long time. I am not sure what to look at within these routines, however. If I time it instruction by instruction, it seems pretty short. What is a long single instruction considered to be? How do I tune something this vaguely defined? Thanks.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Windows Program - form constructor and load taking "a long time"

    Provide sample code, so we can see. All systems are different in configuration and anti-virus installation. Find a simple platform, test there first and compare.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Windows Program - form constructor and load taking "a long time"

    Quote Originally Posted by MMock View Post
    How do I tune something this vaguely defined?
    Ah, the irony. It's obviously not normal for a form to take that long so we can only conclude that you're doing something unusual. How do we determine what that might be when the issue is so vaguely defined?

  4. #4

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,475

    Re: Windows Program - form constructor and load taking "a long time"

    To me, it's like going to the grocery store. You spend $100, on what? Then you see all the little things that added up. They are nothing by themselves but all together they cost a lot of money. Or take a lot of time.

    I know what you're saying but the example that MS gives makes it seem so easy to identify the obvious culprit:
    https://devblogs.microsoft.com/devop...visual-studio/
    As we step over the first few lines we see that they take less than 20ms each, but when we step over GetImagesFromCloud (line 72) it takes about 1,391ms to run.
    *All* my instructions by themselves take less than 20 ms each.
    I'll keep looking, thanks.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Windows Program - form constructor and load taking "a long time"

    Quote Originally Posted by MMock View Post
    *All* my instructions by themselves take less than 20 ms each.
    Then I can only assume that you have an astronomical number of instructions, but it's only an assumption because I can't see them. I've seen very complex forms load in less time than that so, unless there's an issue with your project or your system, I can only conclude that you're doing something unusual. It's not really a good use of my time to go through the list of unusual things that you might be doing and check with you for each one.

  6. #6

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,475

    Re: Windows Program - form constructor and load taking "a long time"

    OK will post code tomorrow but I was just looking for tips, I didn't expect a dedicated analysis of my procedures. Thanks.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Windows Program - form constructor and load taking "a long time"

    My tip would that, if it seems like everything happens quickly when stepping through the code, add a Stopwatch and write its elapsed time to the console after each line of code, then just run it without breaking and stepping. That will give you a better idea of how it runs normally. Like I said, if you have a huge number of steps to complete then it will take time, even if each step is quite quick. A packet of gum is cheap but, if you buy 10,000 packets of gum then your grocery bill will still be hefty. If you don't have all that many steps then at least one of them is going to take longer than expected under those circumstances.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width