Here are some of the per­for­mance bench­marks I’ve col­lected per­son­ally, feel free to ref­er­ence them, but do keep in mind that they should be taken at face value only, and as a rule of thumb you should be bench­mark­ing against your actual data and use case.

Dis­claimer : The bench­marks shown here are mostly cre­ated with sim­ple POCOs, and may not be rep­re­sen­ta­tive of your par­tic­u­lar use case.

 

Binary Seri­al­iz­ers

image21

image18

Ver­sions tested:

Protobuf-net 2.0.0.668
Mes­sagePack 0.1.0.2011042300
FsPick­ler 0.9.5-alpha
Fil­bert 0.2.0
Json.Net 6.0.3
Flu­o­rineFx 1.2.4

 

 

JSON Seri­al­iz­ers

image33

image30

Ver­sions tested:

Jil 1.5.0
ServiceStack.Text 4.0.22
Json.Net 6.0.3
fastJ­son 2.1.1.0
Mon­goDB Drive 1.9.1
System.Json 4.0.20126.16343
System.Text.Json 1.9.9.1
JsonFx 2.0.1209.2802
Jay­Rock 0.9.16530

 

 

Sorted­Dic­tionary vs Dic­tio­nary vs Map vs Array

image

More info here.

 

 

Cost of throw­ing exceptions

image

image

More info here.

 

 

Hash­Set vs List vs Dictionary

image

image

image

More info here.

  • Daniel

    Hi,

    Both JSON.Net and Ser­viceS­tack has got­ten new releases. Any plans on updating?

    //Daniel

  • Pingback: Ranting is good for you « Daniel Wertheim

  • http://hex.lostechies.com Eric Hex­ter

    Could you explain what the mea­sure­ments of the json tests rep­re­sent? What are the mea­sure­ments of the seri­al­iza­tion and dese­ri­al­iza­tion columns? I assume it is the total time taken to per­form the oper­a­tion on a batch num­ber of poco objects? Is that cor­rect ? Thanks, Eric

  • the­burn­ing­monk

    Eric — those are aver­age times in mil­lisec­onds, for infor­ma­tion about the test itself, check out: http://theburningmonk.com/2011/08/performance-test-json-serializers/

  • Omu

    hi Yan,
    it’s not clear on the pic­tures which ones are the best, the tall ones or the small ones, you haven’t explained in the text either, although most lazy ppl (me) won’t read the anyway

  • max

    omu,u’d bet­ter use stan­dard serializer,json seri­al­izer and list,if u are that lazy.
    Thanks to Yan,
    Now i won­der how quick is our cus­tom serializer )

  • Pingback: Performance Test – Json Serializers Part III | theburningmonk.com

  • Pingback: Benchmarking F# Data Structures — Loading Data | craftyThoughts

  • Pingback: Simple Speed Tester – moved to Github! | theburningmonk.com

  • Pingback: Making Amazon SimpleWorkflow simpler to work with | theburningmonk.com

  • Pingback: F# – XmlSerializer, Record types and [CLIMutable] | theburningmonk.com

  • TheXeno­cide

    Just curi­ous if there are any plans to update these bench­marks? In doing some more sim­ple inde­pen­dent tests right now I’m see­ing JSON.NET out­per­form­ing Ser­viceS­tack (though it’s not per­form­ing as well as I’d like it to and I’ll keep dig­ging to see if there’s a more effi­cient mech­a­nism I can use in either). My object graph is also much more com­plex than those used in these tests, so it’s pos­si­ble it’s just per­for­mance char­ac­ter­is­tics par­tic­u­lar to my use case.

    I’d also be inter­ested in see­ing the per­for­mance of System.Collections.Concurrent added to the col­lec­tion tests so we can com­pare the overhead.

  • the­burn­ing­monk

    @Xenocide — yeah, the bench­marks are long over­due for an update (which I’ve been mean­ing to do for a while now), I should hope­fully have some time this week­end to give it a shot!

  • Mads

    Would love to see per­for­mance num­bers for Json.NET 5.0.6, any chance you would get around to update the benchmarks?

    Cheers

  • the­burn­ing­monk

    @Mads — sorry for the delay, been mean­ing to update these bench­mark num­bers for a while and just never got around to doing it.

    I have updated both sets of num­bers (for JSON and binary seri­al­iz­ers) and Json.Net 5.0.6 showed pretty big improve­ment on dese­ri­al­iza­tion speed and clos­ing in on ServiceStack’s lead!

  • Pingback: Binary and JSON serializer benchmarks updated | theburningmonk.com

  • http://blog.codebeside.org Gus­tavo Guerra

    Hi, do you have the source code of your bench­mark for the JSON Seri­al­iz­ers somewhere?

  • https://github.com/ysharplanguage/JSONParser Y#

    Hi,

    Here’s a new kid on the block, to dese­ri­al­ize JSON either into POCOs or into trees of Dictionaries(string, object) :

    https://github.com/ysharplanguage/JSONParser/blob/master/JsonParser.cs

    It’s merely a parser (dese­ri­al­iza­tion use cases only), but it’s pretty fast and short (less than 450 SLOC total). The pub­lic interface’s Parse method is generic and accepts either a JSON pay­load com­ing in one chunk (string), or via a System.IO.Stream.

    I’ve included some tests and their sam­ple data (from kilo­bytes to megabytes) at the above GitHub.

    Enjoy :)

  • https://github.com/ysharplanguage/JSONParser Y#

    Sorry, new home for this exper­i­men­tal parser/deserializer, with updated tests and fig­ures, com­pared to JSON.NET 5.0 r8’s and Ser­viceS­tack 3.9.59’s :

    https://github.com/ysharplanguage/FastJsonParser

  • https://github.com/ysharplanguage/FastJsonParser Y#

    Re-ran the JSON dese­ri­al­ize tests on my lap­top (w/ code below for this System.Text.Json.JsonParser):

    ~ 17% faster than Ser­viceS­tack 3.9.59, ~ 20% faster than fastJ­SON, ~ 29% faster than JSON.NET 5.0 r8

    (464 ms vs. 556 ms vs. 580 ms vs. 651 ms, resp.)

    // speed test Json­Parser
    DoSpeedTest(“JsonParser”, Seri­al­ize­With­J­son­Net, Dese­ri­al­ize­With­J­son­Parser, CountAverageJsonStringPayload);

    //(lines omit­ted)…

    pri­vate sta­tic List DeserializeWithJsonParser(List json­Strings)
    {
    var objects = jsonStrings.Select(new System.Text.Json.JsonParser().Parse).ToList();
    return objects;
    }

  • http://omidid.github.io/FastJsonWriter/ Omid

    Hi, try my project to seri­al­ize JSON.
    http://omidid.github.io/FastJsonWriter/