. NET Core protobuf-net, Messagepack, json.net serialization/deserialization performance testing

Source: Internet
Author: User
Tags key string net serialization object serialization

Test Code Zonciu/serializationtest.cs,
Originated from Neuecc/zeroformatterbenchmark.cs.

NuGet packages and their versions
mgravell/protobuf-net 2.3.2(非官方实现,官方无.NET实现)msgpack/msgpack-cli 1.0.0-beta2(官方实现)neuecc/MessagePack 1.7.2(非官方实现)JamesNK/Newtonsoft.Json 10.0.3
Compatibility protobuf-net
    • Models with no contract attribute are not supported
    • Bring your own attribute
    • Support System.Runtime.Serialization Attribute ,
Msgpack-cli
    • Support for models without contract attribute
    • Bring your own attribute
    • SupportSystem.Runtime.Serialization Attribute
Messagepack
    • Support for models without contract attribute
    • Bring your own attribute
    • SupportSystem.Runtime.Serialization Attribute
Newtonsoft.json
    • Support for models without contract attribute
    • Bring your own attribute
    • SupportSystem.Runtime.Serialization Attribute
Test results
Mgravell/protobuf-net Serialize 4.195 Ms deserialize 10.0423 Ms Reserialize 4.1817 Ms Size of Binary 36.0 0 bmgravell/protobuf-net Serialize 4.172 Ms deserialize 10.0139 Ms Reserialize 4.1776 Ms Size of Binary 3 6.00 bmgravell/protobuf-net Serialize 4.4121 Ms deserialize 10.2684 Ms Reserialize 4.2439 Ms Size of Bina Ry 36.00 bofficial msgpack-cli Serialize 6.9675 Ms deserialize 14.4727 Ms Reserialize 6.7491 Ms Size of B Inary 36.00 bofficial msgpack-cli Serialize 6.7087 Ms deserialize 14.4588 Ms Reserialize 6.9524 Ms Size O F Binary 36.00 bofficial msgpack-cli Serialize 6.7676 Ms deserialize 14.5932 Ms Reserialize 6.9552 MS Siz E of Binary 36.00 Bneuecc/messagepack-csharp Serialize 3.703 Ms deserialize 4.3366 MS Reserialize 3.6741   Ms Size of Binary 32.00 Bneuecc/messagepack-csharp Serialize 3.7056 Ms deserialize 4.6376 MS Reserialize 3.6672 Ms Size of Binary 32.00 Bneuecc/messagepack-csharp Serialize 3.6871 Ms deserialize 4.2972 Ms Reserialize 3.6756 Ms Size of  Binary 32.00 Bnewtonsoft.json Serialize 17.5037 Ms deserialize 33.8181 Ms Reserialize 21.2306 Ms Size of  Binary 90.00 Bnewtonsoft.json Serialize 18.4885 Ms deserialize 35.5003 Ms Reserialize 17.4223 Ms Size of  Binary 90.00 Bnewtonsoft.json Serialize 18.1058 Ms deserialize 32.0834 Ms Reserialize 23.5259 Ms Size of Binary 90.00 bmgravell/protobuf-net Serialize 6546.5884 Ms deserialize 11488.7313 MS Reserialize 6709.27 Ms Size of Binary 37.11 kbmgravell/protobuf-net Serialize 6564.3259 Ms deserialize 11431.9974 MS Reseria  Lize 6679.0116 Ms Size of Binary 37.11 kbmgravell/protobuf-net Serialize 6561.8096 ms Deserialize 11476.1318    Ms Reserialize 6668.9106 Ms Size of Binary 37.11 kbofficial msgpack-cli Serialize 5617.6389 MS deserialize 14581.9512 Ms ReseRialize 5578.6621 Ms Size of Binary 38.82 kbofficial msgpack-cli Serialize 5590.4476 ms Deserialize 14763.01 4 ms Reserialize 5533.6327 Ms Size of Binary 38.82 kbofficial msgpack-cli Serialize 5607.3836 Ms Deserializ E 14615.2356 Ms Reserialize 5585.7651 Ms Size of Binary 38.82 kbneuecc/messagepack-csharp Serialize 3065.331 2 ms Deserialize 4371.5859 Ms Reserialize 3062.9087 Ms Size of Binary 32.83 kbneuecc/messagepack-csharp Ser Ialize 3116.9423 Ms Deserialize 4392.1279 Ms Reserialize 3061.0422 Ms Size of Binary 32.83 Kbneuecc/messagepac K-csharp Serialize 3080.5855 Ms deserialize 4385.2026 Ms Reserialize 3054.3972 Ms Size of Binary 32.83 KB  Newtonsoft.json Serialize 13303.1545 Ms deserialize 24219.7497 Ms Reserialize 13346.126 Ms Size of Binary  86.81 Kbnewtonsoft.json Serialize 13362.7296 Ms deserialize 24238.1881 Ms Reserialize 13332.8785 MS Size of Binary 86.81 KbnewtoNsoft. Json Serialize 13399.7856 Ms deserialize 24197.9922 Ms Reserialize 13325.7399 Ms Size of Binary 86.81 KBn Euecc/messagepack-csharp without Attribute Serialize 3.9342 Ms deserialize 4.9817 Ms Reserialize 3.9434 m    s Size of Binary 65.00 Bneuecc/messagepack-csharp without Attribute Serialize 3.9854 Ms deserialize 4.9978 MS    Reserialize 3.9498 Ms Size of Binary 65.00 Bneuecc/messagepack-csharp without Attribute Serialize 3.9393 ms      Deserialize 5.1384 Ms Reserialize 3.9293 Ms Size of Binary 65.00 Bneuecc/messagepack-csharp without Attribute Serialize 3968.4564 Ms Deserialize 4912.953 Ms Reserialize 4082.8229 Ms Size of Binary 65.06 kbneuecc/message Pack-csharp without Attribute Serialize 3967.5422 Ms deserialize 4912.2183 Ms Reserialize 4059.2614 MS Si Ze of Binary 65.06 kbneuecc/messagepack-csharp without Attribute Serialize 3952.6747 MS Deserialize 4974.3738 Ms Reserialize  4066.7528 Ms Size of Binary 65.06 KB 

Single-object serialization, deserialization, and time-of-serialization

serialization, deserialization, and re-serialization of multi-object arrays

Data size after single-object serialization

Data size after serialization of multi-object arrays

Conclusion

Neuecc/messagepack performance is optimal, the official MSGPACK-CLI performance is poor, PROTOBUF does not support the contract attribute model, meaning the need to invade the model.

With Messagepack, the model adds contract attribute and adds an int order, a little faster than adding a attribute or a string key, and the data volume is significantly reduced after serialization, The reason is that when attribute is not used or string attribute key is used, the member name or key string is used as the index, and the int index instead.

. NET Core protobuf-net, Messagepack, json.net serialization/deserialization performance testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.