CLR keeps on probing for XmlSerializers assembly

V

Vagif Abilov

I noticed that components that use XmlSerializer class cause CLR to probe
for XmlSerializers assembly. Is this default behavior, i.e. whenever
component try to serialize/deserialize one of its classes, CLR will search
for pre-compiled serializer? If so, can I simply use SGEN tool to generate
such assembly and CLR will automatically use it? And will it really give a
significant performance advantage?

Thanks in advance
Vagif Abilov
Oslo Norway
 
B

Ben Voigt

Vagif Abilov said:
I noticed that components that use XmlSerializer class cause CLR to probe
for XmlSerializers assembly. Is this default behavior, i.e. whenever
component try to serialize/deserialize one of its classes, CLR will search
for pre-compiled serializer? If so, can I simply use SGEN tool to generate
such assembly and CLR will automatically use it? And will it really give a
significant performance advantage?

The cost of generating the serializer is substantial (since Reflection.Emit
is quite heavy-duty), however the ongoing performance should be equal since
I believe it's the same code used for pre-compiling and on-the-fly, and that
the on-the-fly serialization assembly is cached for the lifetime of the
appdomain.
 
V

Vagif Abilov

Thanks, so this means once generated it will be kept as long as AppDomain
lives. Then we will probably afford online generation.

Vagif
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top