![]() It is surprising to see that plain XML serialization is the second fastest in these tests. Protobuf has the best read performance and Servicestack the worst. These files were then imported into an excel and the average was calculated for each serializer. The tests are saved to txt files in a csv format. Net Xml" + Environment.NewLine) į("Protobuf, Newtonsoft Json,Newtonsoft Bson, ServiceStack Json. Static void DoTestForNObjects(int amount, int repeatTest)įileAccess.ExcelResultsReadAndWrite = new StringBuilder() įileAccess.ExcelResultsRead = new StringBuilder() įileAccess.ExcelResultsWrite = new StringBuilder() įileAccess.ExcelResultsSize = new StringBuilder() įileAccess.AmountOfChildObjects = amount į("Protobuf, Newtonsoft Json,Newtonsoft Bson, ServiceStack Json. Using FileAccess = ĭoTestForNObjects(500, repeatTestNTimes) ĭoTestForNObjects(5000, repeatTestNTimes) ĭoTestForNObjects(50000, repeatTestNTimes) The results will always be different for different hardware, operating systems be what remains the same is the relative difference between the serializers. The results remain consistent for file of all sizes up to 100MB. The tests are repeated for different sizes. The tests can set the amount of child objects. The test measures the whole operation and not just serialization to a memory stream.įor Serialization, the tests use an Object class with int, double, string, Object properties and also a List of Objects. This post compares the Serialization to files using Protobuf, Json.NET (Newtonsoft) JSON and BSON, Servicestack Json and plain.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |