快速,简单对象序列化对象、快速、简单、序列化

2023-09-03 07:06:14 作者:六字大全

我在找最快的序列化方法的瓷砖在2D世界。可以说,这个世界很大,并因为电脑不能处理的同时加载多块,所以我分裂这个世界块。 的BinaryFormatter 似乎是缓慢的。有没有更快的方法,如何序列块对象?

WChunk对象结构

 公共类WChunk
{
    公众诠释ChunkX;
    公众诠释矮胖;
    公共SortedDictionary< WPoint,WTile>瓷砖;
}
 

WTile对象结构

 公共类WTile
{
    WPoint位置;
    INT数据;
}
 

解决方案

最快的选择,我知道的是 Protocol Buffers的

这里有一个性能比较(感谢@Andrei)

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

.NET实现

Java对象的序列化

HTTP://$c$c.google.com/p/protobuf-net/

http://$c$c.google.com/p/protobuf-csharp-port/

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

解决方案

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/