locked
Preload assemblies RRS feed

  • Question

  • Hi

    I have an editor class library as a separate assembly which exposes about 50 classes / public types.
    And also references some "huge" 3rd party dlls (Telerik btw)
    Loading the main class of this library in a "layer" window of the main application for the first time
    lasts long - too long for an average user.
    While loading one can see in the output window of VS that lots of assemblies are loaded,
    and afaics also the JIT compiler has some work to do because the said types are used for
    the first time.
    When lauching the whole stuff for the second and all further times it runs fast.

    So my question: Can I somehow tweak my application to preload the the assemblies in the
    background when it starts, so the first-load hiatus of the editor layeris shortened?

    Thanks,
    Chris


    Tuesday, February 7, 2012 8:16 PM

Answers

All replies


  • So my question: Can I somehow tweak my application to preload the the assemblies in the
    background when it starts, so the first-load hiatus of the editor layeris shortened?

    No, but the assemblies will load the first time you reference a type within the specific assembly.

    If you have a splash screen or other loading process, you can just create an instance of the type in question, and it will force the assembly to be loaded right then.  For example, just doing:  "new DataGrid();" will force the telerik assemblies required by the Rad DataGrid to load...


    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Tuesday, February 7, 2012 9:15 PM
  • You're on your own for making it run in the background, but pre-jiting an assembly at runtime is quite easy:

    Codeproject: Pre-compile (pre-JIT) your assembly on the fly, or trigger JIT compilation ahead-of-time

    Wednesday, February 8, 2012 10:01 PM
  • Hi Chris,

    If you ngen the binaries at install time, this may give you a significant performance boost.

       The Performance Benefits of NGen.
       To NGen or Not to NGen?

    Sincerely,


    Ed Dore

    Thursday, February 9, 2012 4:49 AM
  • Thanks a bunch to all of you

    NGEN seems cool as does Pre-JITing

    Regards,
    Chris
    Saturday, February 11, 2012 5:31 PM