예제 #1
0
        public void BinaryPackBench()
        {
            SmallValueMsg msg = _smallValueMsg;

            byte[] data = BinaryConverter.Serialize(msg);
            msg = BinaryConverter.Deserialize <SmallValueMsg>(data);
        }
예제 #2
0
        public void MessagePackBench()
        {
            SmallValueMsg msg = _smallValueMsg;

            byte[] bytes = MessagePackSerializer.Serialize(msg);
            msg = MessagePackSerializer.Deserialize <SmallValueMsg>(bytes);
        }
예제 #3
0
        public void StructPackerBench()
        {
            SmallValueMsg msg = _smallValueMsg;

            using PooledBuffer slice = msg.PackToBuffer();
            msg.Unpack(slice.Data);
        }
예제 #4
0
        public void NewtonsoftJsonBench()
        {
            SmallValueMsg msg = _smallValueMsg;

            string data = JsonConvert.SerializeObject(msg);

            msg = JsonConvert.DeserializeObject <SmallValueMsg>(data);
        }
예제 #5
0
        public void BinaryFormatterBench()
        {
            SmallValueMsg msg = _smallValueMsg;

            using var memStr = new MemoryStream();

            _binFormatter.Serialize(memStr, msg);
            memStr.Position = 0;
            msg             = (SmallValueMsg)_binFormatter.Deserialize(memStr);
        }