Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Speed initial load

Speed initial load

Scheduled Pinned Locked Moved Visual Basic
performancehelptutorialquestioncode-review
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cstrader232
    wrote on last edited by
    #1

    I've created a big program (2.5M) and it's loading slowly on startup. Could someone please point me to ideas on how to improve this. Many of the subroutines are rarely or never needed by many users. So I'm thinking of putting them in separate .dlls. Would that help? Tia

    W D 2 Replies Last reply
    0
    • C cstrader232

      I've created a big program (2.5M) and it's loading slowly on startup. Could someone please point me to ideas on how to improve this. Many of the subroutines are rarely or never needed by many users. So I'm thinking of putting them in separate .dlls. Would that help? Tia

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Breaking the application to smaller pieces using dll's would help. However, if the application size is 2.5MB and it's starting up slowly, I would guess that the problem is somewhere else. Perhaps you're doing lot's of initializations in the beginning. Also you could check the compiler settings and let it do optimizations and remove the debug constant.

      The need to optimize rises from a bad design.My articles[^]

      1 Reply Last reply
      0
      • C cstrader232

        I've created a big program (2.5M) and it's loading slowly on startup. Could someone please point me to ideas on how to improve this. Many of the subroutines are rarely or never needed by many users. So I'm thinking of putting them in separate .dlls. Would that help? Tia

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        If you've got a ton of code in your startup form or an excessive number of controls on it, then this is going to be a problem. To partially solve the problem of a large code-base, you can move non-UI involved code to another class (class library). If you have an excessive number of controls, there's nothing you can do about it except re-design your app. You can also try running NGEN on the installed application to generate the native code assemblies for that machine, but don't count on a huge performance gain from this.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        C 1 Reply Last reply
        0
        • D Dave Kreskowiak

          If you've got a ton of code in your startup form or an excessive number of controls on it, then this is going to be a problem. To partially solve the problem of a large code-base, you can move non-UI involved code to another class (class library). If you have an excessive number of controls, there's nothing you can do about it except re-design your app. You can also try running NGEN on the installed application to generate the native code assemblies for that machine, but don't count on a huge performance gain from this.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          C Offline
          C Offline
          cstrader232
          wrote on last edited by
          #4

          Thanks to you both. So the code in the class libraries is not loaded by my program until it is needed, saving time on startup? Is that the idea?

          D 1 Reply Last reply
          0
          • C cstrader232

            Thanks to you both. So the code in the class libraries is not loaded by my program until it is needed, saving time on startup? Is that the idea?

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            Yep. entire assmeblies are not compiled when needed. The JIT compiler only compiles what is needed at the time, if it hasn'y already been compiled. You can have an assembly with (bite-my-tongue) 1,000 methods in it, so only them method being called will get compiled at the time it's needed. The remaining methods won't be compiled until they're needed.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            C 1 Reply Last reply
            0
            • D Dave Kreskowiak

              Yep. entire assmeblies are not compiled when needed. The JIT compiler only compiles what is needed at the time, if it hasn'y already been compiled. You can have an assembly with (bite-my-tongue) 1,000 methods in it, so only them method being called will get compiled at the time it's needed. The remaining methods won't be compiled until they're needed.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              C Offline
              C Offline
              cstrader232
              wrote on last edited by
              #6

              But that last comment, Dave, makes it sound as if this is true for all methods, not just methods in the accompanying class libraries. So why is there an advantage of moving code from the .exe into the .dlls?

              D 1 Reply Last reply
              0
              • C cstrader232

                But that last comment, Dave, makes it sound as if this is true for all methods, not just methods in the accompanying class libraries. So why is there an advantage of moving code from the .exe into the .dlls?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                Having everything in a monolithic .EXE file takes the loader forever to load and process, setup the runtime environment (.NET CLR), pass control to the CLR, which reads what it needs, compiles the necessary methods, if not already previously done, and calls the entry point of the code, which will call other methods in the code, and finally getting around to calling InitializeComponent for all of the controls, again, more compiling, and creating an instance of the form. There's a LOT that happens before you see your startup form...

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                W 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  Having everything in a monolithic .EXE file takes the loader forever to load and process, setup the runtime environment (.NET CLR), pass control to the CLR, which reads what it needs, compiles the necessary methods, if not already previously done, and calls the entry point of the code, which will call other methods in the code, and finally getting around to calling InitializeComponent for all of the controls, again, more compiling, and creating an instance of the form. There's a LOT that happens before you see your startup form...

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  W Offline
                  W Offline
                  Wendelius
                  wrote on last edited by
                  #8

                  Dave Kreskowiak wrote:

                  There's a LOT that happens before you see your startup form

                  And that's not even all :)

                  The need to optimize rises from a bad design.My articles[^]

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups