Performance Improvement?

Topics: APIs, General
Nov 29, 2014 at 3:54 PM
Hello Community,

I am experimenting with Fody, Cecil, and Roslyn. I am doing this as I am creating a Xamarin.Forms framework, and since iOS does not allow dynamic code, all AOP/intercepted code must be compiled ahead-of-time (AOT, not to be confused with AOP LOL).

First off, I have to really commend the team with Roslyn. It was really easy to piece this together. However, currently a simple compile takes over 800ms to emit (compilation takes around 50ms), and I am curious if there is something I am doing inefficiently and/or if there is something I can do to improve the performance.

I have this code posted @ GitHub, and you can see what I am doing here, with this link taking you to the line that is consuming all the time:
https://github.com/Michael-DST/Fody/blob/master/Integration/Weavers/RoslynCecilWeaver.cs#L108

Any insight you can provide would be greatly appreciated!

Thank you,
Michael
Dec 1, 2014 at 2:15 PM
I've also written some code that makes use of Emit() and I've seen similar timings.

One thing I noticed was that the first call always takes a long time, but subsequent calls are always quicker (even when compiling/emitting different C# code).

So it seems like there is some caching going on somewhere and/or there are start-up costs.
Developer
Dec 2, 2014 at 1:48 AM
The are startup costs. One is the cost to load the metadata, the other is the loading/jitting of the roslyn codebase that happens when you are using the Nuget dlls, and not the prejitted versions that get put in the registry when VS is installed.
Dec 2, 2014 at 3:08 PM