Subscribe to the RSS feed then follow me on twitter at @mrlacey (misc) and @wpug (WPDev news)

Tuesday, August 20, 2013

Faster JSON serialization with ServiceStack.Text

I've been using JSON.Net to serialize objects to and from JSON for years.

However, ever since I heard that ServiceStack had a faster JSON serializer I've wanted to try it.
After all, speed is important, especially on a mobile devices, and if I can make my code run faster by just swapping out one third party library for another then that's a simple decision.


Today I finally got around to trying it and to do so I built a console app so I could put the two methods side by side.


Look both methods are very similar. And as I rarely do anything more complicated with JSON than just serialize or deserialize this is great.

Obviously the above isn't enough for me to prove that it's faster. I'm just trusting the benchmark testing done by others.

It's also a smaller DLL so it will reduce the overall XAP size and download time. Plus app load time too. :)



My only slight reservation is that ServiceStack doesn't give me the debugging assistance I get with Json.Net. Maybe I'll look to just use Json.Net in the debug build if this becomes an issue.


Are you a Windows Phone, Nokia-X (Android) or Asha developer? If so, you could be getting rewards for the apps you build and the success they achieve by joining the DVLUP program.

No comments:

Post a Comment