none
One assembly per class or all classe in the same assembly? RRS feed

  • Question

  • Hi,

    I have a .NET middleware App that uses several Business components (1 component=1 class). there is a diferent assembly for each of these components .

    What are the considerations to use one assembly per class or all classes in the same assembly?

    what are the performance implications of each alternative (CPU usage, memory usage, assemblu cache)?

    Does the frameworks loads all classes in the assembly on just the classes that are used?

    Is the any difference on those considerations depending on the way I use the components classes, i.e: early-binding vs late-bing (via Activator.CreateInstance)??

    Help is really appreciated.

    Thanks in advance,

    DD

     

    Wednesday, March 16, 2011 5:26 PM

Answers

  • No. Only the first time. Once it's JIT compiled, next time no need of compiling. It uses already compiled code.


    Please mark this post as answer if it solved your problem. Happy Programming !!!
    • Marked as answer by DevDiver Thursday, March 17, 2011 2:40 PM
    Thursday, March 17, 2011 11:00 AM

All replies

  • What are the considerations to use one assembly per class or all classes in the same assembly?

    ----- Assembly is a group of classes that contribute towards what an assembly meant for. So, an assembly can contain many classes.

    what are the performance implications of each alternative (CPU usage, memory usage, assemblu cache)?

    ----- There is no performance implications in having many classes in the same assembly. In fact if you have only one class in each assembly it will affect the performance since there will be some delay in loading each assembly.

    Does the frameworks loads all classes in the assembly on just the classes that are used?

    ----- When your assembly is compiled, all classes are interpretated to MSIL. When you run the program, only that code is compiled which is actually used.

    Is the any difference on those considerations depending on the way I use the components classes, i.e: early-binding vs late-bing (via Activator.CreateInstance)??

    ----- No

    Hope this helps.


    Please mark this post as answer if it solved your problem. Happy Programming !!!
    Thursday, March 17, 2011 6:38 AM
  • Hi Adavesh,

    Tks for your response.

    When you say "...there will be some delay in loading each assembly..." you mean each time I create an instance of that class or only the first, i.e: How can I know if it is used from the assembly cache or loaded from disk each time?

    Thanks again,

    DD

    Thursday, March 17, 2011 10:44 AM
  • No. Only the first time. Once it's JIT compiled, next time no need of compiling. It uses already compiled code.


    Please mark this post as answer if it solved your problem. Happy Programming !!!
    • Marked as answer by DevDiver Thursday, March 17, 2011 2:40 PM
    Thursday, March 17, 2011 11:00 AM