# Wednesday, August 27, 2008
« Using Mono.Cecil instead of Reflection.E... | Main | New Development Snapshot »
Cecil Conclusion

I finished the Cecil.Reflection.Emit prototype of ikvmc. As I, unfortunately, expected the performance isn't acceptable. Compiling tools.jar takes approx. 18 seconds with the Ref.Emit backend, but takes 51 seconds with the Cecil based backend.

Now, I'm not knocking Mono.Cecil because of its performance, because I think the design was based on making it easy to load an assembly, tweak it and write it back out again. For that application the design makes a lot of sense, but it is less efficient for a write only task.

However, I did have to conclude that Mono.Cecil is not mature enough for usage with ikvmc. I had to write my own custom attribute encoder to work around Mono.Cecil's brokenness and I found that it doesn't properly support custom modifiers.

What Next

Given that neither Ref.Emit nor Cecil look like viable short term strategies for multi target support in ikvmc, I think it makes sense to start working on the 0.38 release now and put off the splitting of IKVM.OpenJDK.ClassLibrary.dll until the next release. I know this will disappoint some people, especially since it grew by about 4.7MB again (mostly due to the inclusion of the charsets.jar character encodings).

I don't have a timetable, but don't expect the release tomorrow. It'll be a while. First OpenJDK6 b12 needs to be released (and integrated) and then a whole lot of testing needs to be done.

Wednesday, August 27, 2008 6:11:46 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [3]
Wednesday, August 27, 2008 5:12:23 PM (W. Europe Daylight Time, UTC+02:00)

We are evaluating to switch mcs to use Cecil instead of SRE.

The usage of cecil for this end sounds very similar to yours, do you mind sends the changes to IKVM and how to reproduce your test to one of our mailing list? Please, include the the bugs as well.

We (the mono team) would love to work with you to see if it's possible to optimize CECIL to match SRE performance.

Rodrigo Kumpera
Wednesday, August 27, 2008 6:43:12 PM (W. Europe Daylight Time, UTC+02:00)
The custom attribute issues are definitely annoying. I ended up working around them by changing the Mono.Cecil API and submitting a patch.

Also, the lack of portable PDB support is a little frustrating. Still... it works, and it's clear that a lot of effort has gone into it, despite the bugs.

Microsoft has another reflection library that may be more appropriate for tasks that involve assembly rewriting: Microsoft.ExtendedReflection. Pex uses it. Unfortunately I'm not sure whether this library is publicly available or redistributable.
Thursday, August 28, 2008 6:12:51 AM (W. Europe Daylight Time, UTC+02:00)
Rodrigo: I've updated http://www.frijters.net/ikvm-cecil.zip
Comments are closed.