[Mono-dev] high-freq use of compiler as a service or reflection.emit

Rodrigo Kumpera kumpera at gmail.com
Tue Feb 14 20:42:30 UTC 2012


On Tue, Feb 14, 2012 at 2:27 PM, Jonathan Shore <jonathan.shore at gmail.com>wrote:

> I have an application where rules are generated (as part of a genetic
> algorithm).   Rather than evaluate the rules in interpreted form (which are
> 5x or more slower than the equivalent compiled code), thinking to use
> reflection.emit or the mono compiler as a service.
>
> Millions of rules are generated across time within the scope of one
> process / AppDomain.   During the computation of fitness each rule is
> evaluated millions of times, but once fitness is computed, the rule will
> never need to be evaluated again.   Computing fitness takes 10-20 seconds,
> so the cost of this in ratio to compilation is small.   Hence increasing
> the performance by 5x is desirable.
>
> With the above in mind:
>
>
>    1. I assume I can remove a class created with the compiler as a
>    service?
>
>
No, class unloading only happens as part of AppDomain unloading.

>
>    1. Would there be residual in the JIT or elsewhere that will
>    accumulate, becoming a memory leak issue?
>
> See the above.

>
>    1. If I am running with llvm enabled, will the compiler as a service
>    or reflection.emit make use of LLVM for JIT?
>
> Yes, but expect compilation times to increase 10 fold.


>
>    1. Should I prefer the Mono api or reflection.emit for performance or
>    other reasons?
>
>
If you're loading assemblies, it doesn't matter.

>From your description you should use dynamic methods since 4.0 collectible
assemblies are not supported.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120214/8c4746b7/attachment.html>


More information about the Mono-devel-list mailing list