AqlaSolutions / AqlaSerializer

Binary serializer with full .NET support!
http://www.aqla.net
Other
17 stars 3 forks source link

RuntimeTypeModel.Default.CompileInPlace is too slow #38

Closed inethui closed 2 years ago

inethui commented 2 years ago

We have more than 5800 classes which are registered with "RuntimeTypeModel.Default". However if I run CompileInPlace against the model, it takes more than 3 minutes. Is there a way to speed this up?

AqlaSolutions commented 2 years ago

No, but you can run Model.Compile("assembly.dll") once as a part of your publish process instead of using CompileInPlace each time. Though, in this case serializers can't access private members of your classes.

AqlaSolutions commented 2 years ago

And for debugging experience you can run without serializers compilation at all to have faster startup times (AutoCompile = false) though serialization itself will be slow.

inethui commented 2 years ago

We have to access the private fields of classes. How does Aqla access private fields? Is it through generated IL code or use reflection APIs?

AqlaSolutions commented 2 years ago
  1. Reflection if AutoCompile = false
  2. In-memory IL if CompleInPlace() is called
  3. Can't access from disk dll assembly if Compile is called
inethui commented 2 years ago

This is very helpful, thank you.