What's the fastest Serialization mechanism for c#?

后端 未结 9 1483
攒了一身酷
攒了一身酷 2021-02-09 07:38

This for small payloads.

I am looking to achieve 1,000,000,000 per 100ms.

The standard BinaryFormatter is very slow. The DataContractSerializer is slow than Bina

9条回答
  •  我寻月下人不归
    2021-02-09 08:04

    You claim small items are slower than BinaryFormatter, but every time I'e measured it I've found the exact opposite, for example:

    Performance Tests of Serializations used by WCF Bindings

    I conclude, especially with the v2 code, that this may well be your fastest option. If you can post your specific benchmark scenario I'll happily help see what is "up"... If you can't post it here, if you want to email it to me directly (see profile) that would be OK too. I don't know if your stated timings are possible under any scheme, but I'm very sure I can get you a lot faster than whatever you are seeing.

    With the v2 code, the CompileInPlace gives the fastest result - it allows some IL tricks that it can't use if compiling to a physical dll.

提交回复
热议问题