Matej Kormuth
Matej Kormuth

Reputation: 2275

Fast simple object serialization

I am looking for fastest serialization method tiles in 2D world. Lets say the world is big and because computer can't handle that much blocks loaded at the same time, so I splitted the world to chunks. BinaryFormatter seems to be slow. Is there any faster method, how to serialize the chunk object?

WChunk object structure

public class WChunk
{
    public int ChunkX;
    public int ChunkY;
    public SortedDictionary<WPoint, WTile> Tiles;
}

WTile object structure

public class WTile
{
    WPoint Location;
    int Data;
}

Upvotes: 6

Views: 1664

Answers (1)

Eric J.
Eric J.

Reputation: 150108

The fastest option I'm aware of is Protocol Buffers.

There is a performance comparison here (thanks @Andrei)

http://theburningmonk.com/2011/08/performance-test-binaryformatter-vs-protobuf-net/

enter image description here

.NET implementations

http://code.google.com/p/protobuf-net/

http://code.google.com/p/protobuf-csharp-port/

Upvotes: 12

Related Questions