Fast simple object serialization

北战南征 提交于 2020-01-01 09:38:26

问题


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;
}

回答1:


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/

.NET implementations

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

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



来源:https://stackoverflow.com/questions/11550762/fast-simple-object-serialization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!