XML Transformation: Xslt vs .NET. Part 2

Part 1.
Part 2.
Part 3.

In the first part, I have compared the Xslt transformations of the XML documents with the Object transformations. It happens the Object transformations are faster in most cases. They are also simpler from the developer point of view.

The next natural question is “If we use Json instead of XML, how faster the transformations would be?

If we got a freedom to choose Object transformations instead of Xslt transformations, it might be, we got even more freedom and choose Json or other contemporary serializing formats instead of XML. If this is a case, we should know possible improvements, right?

Changes in the Test Project

The test project code is on the GitHub.

I have added NetSerializer Json serializer. You can get it as a NuGet “NetSerializer” package. It is one of the fastest Json serializer in .NET. The Object transformations now executed in two modes: with XML serialization and with Json serialization.

Test Results

clip_image002[4]clip_image004[4]clip_image006[4]

Practical Conclusions:

It is worth to use Json instead of XML in Object transformations, if we have a choice

  • Json gives us a speed improvement:
    • for small documents of the several KByte size the improvement could be >100%
    • for documents of the several MByte size the improvement could be >30%
  • The code for Object transformation itself is the same, so there is no additional development effort to use Json instead of XML
Print | posted on Monday, March 30, 2015 5:25 PM

Feedback

# re: XML Transformation: Xslt vs .NET. Part 2

left by Monica at 4/6/2015 4:14 PM Gravatar
I'm not sure that I realize what this program should actually do, but I go in generally for logical deductions and this is a strategy which helps me everytime. I am looking forward to see with what kind of software you are coming next time.
Zuzi
Post A Comment
Title:
Name:
Email:
Comment:
Verification: