dcsimg
Results 1 to 14 of 14

Thread: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Controls

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2018
    Posts
    2

    VB6 performance (with youtube example) of Windows XP vs 10 and using of User Controls

    We have had a significant increase in customers complaining lately that their systems are running slow.
    After investigating and ruling out the backend processes on the server we looked at the front end.
    We found when running the front end on a Windows XP OS the app loads new forms around 5 time quicker than when running on Windows 10.
    This 5 time quicker means that some screen that should take 2 seconds to load are taking 10 seconds. The users of the business-critical system are quite rightly not happy about this.

    The front-end VB6 app was first created about 20 years ago and makes extensive use of “User Controls”.
    Most User Controls contain a number of other controls in them, some of these being other “User Controls”
    Some forms in the app can contain up to around 50 top level User Controls on them.
    So taking into account the User Controls within User Controls this makes quite a large number of controls in total on some forms.
    We think this is what’s triggering the problem and have made a standalone test app to try and prove this.

    We’ve tried a lot of googling, and looking through this forum, but have so far not found anything that helps. Also not had any luck playing with DPI settings.
    Therefore we thought we’d make this post and hoping this community can point us in the right direction if this is a known issue, or help investigate if not. However we are expecting this is not the first time someone has had this problem.

    I’ll try and attached the standalone project here as a zip so others could reproduce these results.

    I’ll also try adding a link to a youtube vid of this example program showing a screen with around 1000 users controls on it. (Our app does not have this many controls, but this large number helps highlight the issue)
    https://youtu.be/xnaGDctNKPE




    This vid shows Win XP running side-by-side with Win 10 and the performance of the same small example program running on both.
    In the vid example a time is recorded before the form3.show() is called and another time is record when form_activate() exits. The final frame from the vid showing the results is posted below. The results are:
    - Win XP = 6 seconds
    - Win 10 = 56 seconds

    Name:  still of last frame XP vs 10.jpg
Views: 147
Size:  35.3 KB

    If there is a silver bullet to get this app running quicker on Win10 then this will probably help us a lot.
    Thanks for reading this far and help guidance greatly appreciated.
    Attached Files Attached Files
    Last edited by mark_leicester; Today at 07:43 AM. Reason: Re-added zip without .exe also added new zip with options set false

  2. #2
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,134

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    AutoRedraw = False
    HasDC = False
    ClipControls = False


    should give you at least a 4x speed boost.

    edit:
    Allocating that many DCs on windows is... I want to say ignorant, but who actually knows anything about Win32 internals these days. The glory days of Petzold are long gone.

    I'm sure you probably already know the real solution is not to abuse the User Control in such a way. You've gone way past it's practical limits. Maybe post a screen of an actual use case, to elicit some redesign ideas.

    Good luck!
    Last edited by DEXWERX; Dec 7th, 2018 at 11:22 AM.

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,332

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    If you are going to throw an issue out there giving us little to go on but "Windows 10 vs Windows XP" it is hard to make many suggestions.

    Did the problem also occur when running on Windows Vista? Windows 7? Windows 8? Windows 8.1? And which Windows 10? It has been undergoing significant changes since first released... you could say we're at Windows 12 or 14 right now in a sense except that Microsoft stopped incrementing the major version number for marketing purposes.

    One obvious thing that happened post-XP was Desktop Composition. Depending on how these UserControls have been written that might have a major impact. But right now I'm not sure you have told us enough to suggest that UserControls are at the heart of the matter. For all we can tell there may be some expensive appcompat shims involved.

    Depending on what is going on with client machine DPI settings DPI virtualization might have some impact. A simple thing here might be to be sure you are testing on a Windows 10 machine at 96 DPI.

    We just don't know enough about your application. Without the source code of a test case that exhibits the problem I'm not sure what we can suggest outside of wild guesses.

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,556

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    So in this sample there are 572 user controls on the form and those user controls contain 5 controls each which means we have nearly 3000 controls on one form which IMO is way way to many. Not surprised that it is very slow. I loaded it and gave it a test run on my system under Windows 7 ~14 seconds to load. It also is very slow loading in the IDE. I tried changing the DPI to the default 96 as a test but no noticeable difference.

    It may also be a good idea to tell us what PC(s) or VM(s) you are running these tests on as PC performance is part of the equation. In this case I tested it on a AMD P2 1100T 6 Core CPU 8gb ram running Windows 7 Pro

  5. #5
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,556

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    btw the test above was done from the IDE.

    I tried the exe on my Windows 10 Machine. Ryzen 5 1600 16gb ram ~9 seconds
    I tried the exe on the Windows 7 box ~13 seconds

    I also tried the exe with the project open in VB6 on the Windows 7 machine ~ 130 seconds

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,332

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    I guess I completely missed the attachment above. Mea culpa.

  7. #7
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,244

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    A slight speed increase by setting the Form3 WindowState to Minimized during design.
    Add a Timer to Form3, with interval = 10
    In the Timer event set the enabled property of the Timer to False, set the windowstate of the Form to Normal.

  8. #8
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,134

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    Here's some timing numbers before/after setting
    AutoRedraw = False
    HasDC = False
    ClipControls = False


    Code:
    WinXP:  6s --> 2s
    Win 7: 14s --> 6s
    Win10: 39s --> 9s

  9. #9
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,556

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    Interesting results. I wonder why it is 30% faster for me under Windows 10 than under Windows 7? My Windows 10 box is a stronger CPU with more cores but VB6 doesn't use the extra cores and the CPU speed is about the same on both. Could it be related to the hard drive speed? Maybe Vb creating tmp files or something like that. Windows 7 box has a mechanical HDD where the Windows 10 box uses a M2 Ultra SSD that is about 10-30 times faster than mechanical HDD

  10. #10
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,134

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    I actually don't have a good win10 system handy, just a non-updated VM.
    I bet an updated system would fair better, so YMMV.

    Interesting thought about the SSD!

    @OP --> https://docs.microsoft.com/en-us/pre...512(v%3dvs.60)
    ...although it doesn't seem to mention anything about Device Context resources.

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,734

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    Unfortunately, I had to delete the attachment as it contained compiled code (the exe, at the very least), which this site does not allow because we can't vouch for the safety. Please remove the compiled parts and re-attach. Anybody who needs the exe can re-compile from the source.
    My usual boring signature: Nothing

  12. #12

    Thread Starter
    New Member
    Join Date
    Dec 2018
    Posts
    2

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    Hi all,
    Thanks for the really quick and informative responses!


    To try and answer some of the questions so far…

    @DEXWERX – Thanks for the suggestions and comments. Indeed the test app was to try and highlight what we thought was the problem with our app. To use that many controls in a production app could well be classed as ignorant. Really appreciate the time you must have spent on this running the test app in the different windows version!

    @dilettante – Thanks for the comments. It is hard to state when the problem first started occurring. We did not really receive feedback like this until recently which is why we focused in on Win 10. However it could well be that this app started slowing down over the years with different windows version. If it would provide useful information we could potentially run our app in the different windows versions on the same vm host. This however would take time to achieve but could be done if the resulting information would be of value.

    @DataMiser - Thanks for trying the app and question. The video and screenshot had the information in your asking for. However youtube and this site both reduced the quality so that you cannot really read this anymore. The VM Ware was sitting on the same machine as the one running directly in Win 10. For specs see the latest vid.

    @Arnoutdv – Thanks, we need all the speed increases we can get.

    @Shaggy Hiker - Apologies for including the .exe in the zip. I’ll try and re-upload now without this.





    I can confirm for us adding the below makes the test app run significantly quicker:
    Code:
    AutoRedraw = False
    HasDC = False
    ClipControls = False
    However, when we add these into our own app the speed increase in the problem forms’ loading time is around only 10% better.
    So it helps a little. But we still have the problem.

    I’ve put a new video of the app and a problem screen loading time. However, I have had to remove the screen text to prevent identity. Also I think it would be unlikely that the company would consent to publishing the code for this on-line.

    See below the screen loading:
    https://youtu.be/fB7mTjU14n4 (The pic quality is better directly on Youtube and not on here)



    There are around 130 User Controls on this screen. These have the suggested settings from this site applied.
    The button to show the screen it pressed when the timer in the bottom left cycles pasty 00.

    In Windows XP in VM Ware running on the same machine this screen takes around 2 seconds to load.
    Directly in Windows 10 this takes the 11 seconds.
    What else could be the cause of this(??)

    If we are close to exhausting the suggestions for quick setting changes then are there any (re)design ideas / consents that might help.

    Thanks for all the help so far guys, really appreciate it!!

  13. #13
    Fanatic Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    873

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    Quote Originally Posted by mark_leicester View Post
    What else could be the cause of this(??)
    Loading of comboboxes can usually spin out of control if one (or more) of the lists grows disproportionately.

    cheers,
    </wqw>

  14. #14
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,816

    Re: VB6 performance (with youtube example) of Windows XP vs 10 and using of User Cont

    Hi Mark,

    First of all, welcome to VBForums.

    Secondly, I'd like to throw out a "thank you" for this. My primary project has about a dozen custom user controls, and I've got a few different forms (with the SSTab control) where quite a few of them are used. At the bottom, I attached a picture that gives an example. That orange area is an expanded UC that allows for a slider to be used to specify degrees. And, just as an FYI, yes, I have always made extensive use of control arrays. I'm not sure that form would be possible without them.

    I'm not sure I'm abusing UCs as bad as your example, but I do use them frequently.

    I'd never thought to turn off the HasDC and ClipControls on these things. And I certainly don't need them, as I'm never using their form's background for anything. I just went through and turned off the HasDC and ClipControls, and these forms are loading noticeably faster.

    I suppose a thanks goes out to Dex as well, for providing the answer.

    Never too late to learn a helpful tip.

    Y'all Take Care,
    Elroy

    Name:  FormAndUC.jpg
Views: 8
Size:  83.2 KB
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width