Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the fastest Serialization mechanism for c#?

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 BinaryFormatter.

Protocol buffers (http://code.google.com/p/protobuf-net/) seems slower than the BinaryFormatter for small objects!

Are there any more Serialization mechanisms a should be looking at either hardcore coding or open source projects?

EDIT: I am serializing in-memory then transmitting the payload over tcp on a async socket. The payloads generated in memory and are small double arrays (10 to 500 points) with a ulong identifier.

like image 931
RogerGreen Avatar asked Feb 05 '11 10:02

RogerGreen


1 Answers

Your performance requirement restricts the available serializers to 0. A custom BinaryWriter and BinaryReader would be the fastest you could get.

like image 157
Darin Dimitrov Avatar answered Oct 18 '22 21:10

Darin Dimitrov