Sunday Podcasts 4

Son. If you really want something in this life, you have to work for it. Quiet! They're gonna announce the lottery numbers. Penny Arcade TVPing Pong 1/Ping Pong 2

The guys at Penny Arcade have branched out from podcasts to a web TV show with predictably hilarious results.

There are a lot of good episodes (PA’s crazy hire process!) but I really love this duo covering Penny Arcade’s obsession with Ping Pong and a rematch game against Bungie, the makers of my beloved Halo.

Smack talk, slow-mo ping pong action shots and an agonist sporting a sinister English accent – what’s not to like?

Now let's all get drunk and play ping pong!

NPR: Planet Money PodcastWe Bought A Toxic Asset!

I wouldn’t call Planet Money a pure economics podcast – it definitely has a bit of an opinion about some economic social issues so viewer discretion is advised – but that doesn’t mean it isn’t interesting.

This episode the people at Planet Money buy a toxic asset and explain in simple language what a toxic asset is and why and how you would buy one. It is a lot more entertaining than I ever would have thought possible.

Oh and bonus points for playing both The Gambler and Danger Zone in a single podcast!

Json.NET Performance With Binary Data

Binary data and text file formats (JSON, XML) don’t tend get along. To be included in JSON or XML binary data has to be encode into a text friendly format, generally base64, which creates overhead both in the time spent encoding/decoding binary, and the extra size of the text encoded data in the message.

  "binary": "SGVsbG8gV29ybGQ="

The Test

In our test we’ll compare serializing a message with binary data using common .NET serialization methods and compare the result. First our message…

public class Image
  public string FileName { get; set; }
  public string Author { get; set; }
  public string Caption { get; set; }
  public byte[] Data { get; set; }

And some test data…

This is Fuzzy Bunny. About a year ago he noticed his voice was changing, he had terrible acne, and had fur where there was no fur before.

FileName: bunny_pancake.jpg Author: Hironori Akutagawa Caption: I have no idea what you are talking about so here’s a bunny with a pancake on its head.

The Results

Json.NET and the DataContractSerializer are about equal to each other in the size of the resulting message – each is encoding the image byte array as base64 encoded text. The small edge to Json.NET comes from the smaller size of the JSON metadata compared to the DataContractSerializer’s XML.

Json.NET BSON and the BinaryFormatter are binary formats so they can include the image data directly in the message. They’re approximately 25% smaller than JSON/XML by saving the overhead of base64. Again the Json.NET BSON format is more efficient than the BinaryFormatter making it slightly smaller.

Finally as you can see the WCF DataContractJsonSerializer is by far the least efficient. When I looked into why it performed so badly it turns out that the WCF JsonSerializer serializes binary data as a JSON array of integers, one integer representing each byte. It goes without saying that you should never use the WCF JsonSerializer with binary data.

Lisa, if the Bible has taught us nothing else - and it hasn't - it's that girls should stick to girls' sports, such as hot-oil wrestling, foxy boxing, and such-and-such.

kick it on

.NET Serialization Performance Comparison

Read more about optimizing Json.NET performance here: Json.NET performance


A lot of work around performance went into the latest release of Json.NET, with big improvements in both serializing and deserializing over the previous version.

I can happily say that Json.NET is now faster than both the JavaScriptSerializer and the WCF DataContractJsonSerializer over all scenarios.

Chalmers: "Seymour, you're fired." Skinner: "Did you just call me a liar?" Chalmers: "No, I said you were fired." Skinner: "Oh, that's much worse." 

Other .NET Serializers

The latest performance improvements now puts Json.NET on the same level as the XML based DataContractSerializer which is pretty remarkable.

Also worth noting is Json.NET over binary (BSON) is considerably faster than the .NET BinaryFormatter.

Australian man: "You call that a knife? This is a knife!" Bart: "That's not a knife. That's a spoon." Australian man: "All right, all right, you win. Heh. I see you've played knifey-spooney before."

Serialization Result Data Size

Finally one of the benefits of JSON is its smaller size when compared to equivalent XML. The output of Json.NET is less than half the size of the XML that DataContractSerializer produces (strings have been encoded to UTF8 bytes).

In this test the BSON result is marginally smaller than the JSON result. BSON really shines when serializing byte data (i.e. images, movies, files, etc) where its output will come in at least 30% smaller over JSON because there is no base64 encoding of byte data.

Some men hunt for sport, others hunt for food. The only thing I'm hunting for... is an outfit that looks good. See my vest, see my vest, made from real gorilla chest. See this sweater? There's no better, than authentic Irish Setter. See this hat? 'Twas my cat. My evening wear vampire bat. These white slippers are albino, african endangered rhino. Grizzle-bear underwear, turtle's necks I've got my share. Beret of poodle on my noodle it shall rest. Try my red robin suit. It comes one breast or two. See my vest, see my vest. See my vest!! Like my loafers? Former gophers. It was that or skin my chauffeurs. But a greyhound-fur tuxedo would be best. So, let's prepare these dogs. (Old Woman) Kill two for matching clogs! See my vest... See my vest! Oh please, won't you see my vest!!

You can find the latest version of Json.NET, including source code with the performance tests, here.


kick it on