Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Building your own Serializer and performance considerations  (Read 1293 times)
Zaknafein
Customers
Community Member
*****
Posts: 2674


WWW
« on: September 17, 2008, 12:44:59 AM »

Hello all... I just finished writing a sample and blog article about custom serializers like the XmlSerializer or BinaryFormatter, except one that you'd write yourself from ground up.

As you can imagine, those use reflection quite a lot and reflection comes at a cost. Fortunately, there are ways to speed up reflection operations with DynamicMethod objects and IL "emission". This is what MS calls it when you inject CIL (the CLR's "assembly code") inside runtime-generated methods and hand them to the JIT compiler. It's a very powerful feature of .NET that I'm just beginning to understand.

So the sample is both about serialization, since it provides a working serializer that generates intermediate, agnostic objects from complex classes and can transform them back... but also about IL emission and how you can speed up any reflection operations using that.

Check it out if you're interested!
http://www.theinstructionlimit.com/?p=76

Sample direct link, C#3.5/VS.NET2008 : http://www.theinstructionlimit.com/wp-content/uploads/2008/09/fastreflection.zip
Logged

zaknafein.
>> the instruction limit : my blog & samples repository! <<
Raine
Customers
Community Member
*****
Posts: 1190


« Reply #1 on: September 19, 2008, 06:37:29 AM »

Working with IL is fun. I had to deal with it when doing the entity system compiler (and an old plugin system of mine, but that was mostly for training). It helps understanding the CLR a lot. You get to wish there was a way to inline IL from time to time.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks