I just recompiled my JitCost utility using the RTM CLR bits. I did so because I wanted to take a closer look at some MC++ code that I just wrote today. It’s a fairly complex piece of MC++ code that uses IJW to create an array of managed structures from information gleaned from the unmanaged Metadata API’s. It retrieves the PCCOR_SIGNATURE blob from the unmanaged Metadata API’s, converts it into a string, and maps it to its corresponding MethodDef token.
When I ran my code, I found that it only took 5s to generate a 6.5MB text file that contains all of this data from the 12MB or so of assemblies that the program looked at. This is already pretty impressive. However, nearly 1s of this time was spent inside of the JIT (1400 methods had to be compiled). Clearly, this is a piece of code that should be run through NGEN. I will post a detailed analysis of the NGEN effects later.
Some more caveats for folks who are interested in measuring the performance of their code:
- You need to account for the time taken by the JIT.
- You also need to account for time spent inside the GC (although one could argue that this is part of the execution time of your code). I’ll build a tool later that measures the amount of time spent garbage collecting a long-running application.