Side effect of high type count in an assembly RRS feed

  • Question

  • I'm wondering what the side effect is of having assemblies that have a LOT of classes in them.  Does it slow reflection down?  Are there other hidden costs to higher class count - and of course related to that just having a bigger assembly overall?  The reason I am asking is because I have a decision to make about some code I'm writing.  I can either have a LOT of classes that will make things run faster, or I can reduce the number of classes, but my code won't be quite as efficient. 

    Seems like a weird condition, I know, but it's the result of a system that I'm using so ... that's the choice I have.  I'm just curious what kind of things I have to watch out for if I have a lot of classes in an assembly so I can make a more educated decision about the approach to take.
    Thursday, May 15, 2008 3:47 AM


  • Hi,


    Generally speaking, huge number of classes in assembly can slow down reflection, because metadata table will contain a lot of records in this case. But I believe reflection mechanism is quite optimized and you won't feel the difference.


    The only side effect I see, is that for each type in assembly CLR creates instance of System.Type class, therefore such assembly will require more memory.

    Thursday, May 15, 2008 6:59 AM