Quantcast
Channel: Geekswithblogs.net
Viewing all articles
Browse latest Browse all 3624

XML Transformation: Xslt vs .NET. Part 2

$
0
0

Originally posted on: http://geekswithblogs.net/LeonidGaneline/archive/2015/03/30/xml-transformation-xslt-vs-.net.-part-2.aspx

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.

Viewing all articles
Browse latest Browse all 3624

Latest Images

Trending Articles



Latest Images