How and when are generics realized as real code?
Questions often come up regarding .Net 2.0's generics; how much code is shared, when are the specialized versions created, and how much does it cost? While I want to repeat the refrain I often use—You don't really need to know this—it is useful information. The short version:
- There is one copy of the generic IL
- The JIT creates specializations as they are needed
- All reference-type specializations share one JITted copy
- Each value-type spawns a separate specialization
No comments:
Post a Comment