public void Utf8JsonSerializerToStream() { for (var i = 0; i < N; i++) { _utf8jsonSerializer.Serialize(_data, _utf8jsonSerializerStream); _utf8jsonSerializerStream.Position = 0; } }
public void Setup() { Core.InitDefaults(); var sTest = new STest { FirstName = "Daniel", LastName = "Redondo", Age = 35, value = 166 }; _data = new List <STest> { sTest, sTest, sTest, sTest, sTest, sTest, sTest, sTest, sTest, sTest, sTest, sTest, new STest { FirstName = "Person", LastName = "Person" + "." + 0, Age = 1, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 1, Age = 2, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 2, Age = 3, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 3, Age = 4, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 4, Age = 5, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 5, Age = 6, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 6, Age = 7, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 7, Age = 8, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 8, Age = 9, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 9, Age = 10, Brother = sTest }, new STest { FirstName = "Person", LastName = "Person" + "." + 10, Age = 11 }, new STest { FirstName = "Person", LastName = "Person" + "." + 11, Age = 12 }, new STest { FirstName = "Person", LastName = "Person" + "." + 12, Age = 13 }, new STest { FirstName = "Person", LastName = "Person" + "." + 13, Age = 14 }, new STest { FirstName = "Person", LastName = "Person" + "." + 14, Age = 15 }, new STest { FirstName = "Person", LastName = "Person" + "." + 15, Age = 16 }, new STest { FirstName = "Person", LastName = "Person" + "." + 16, Age = 17 }, new STest { FirstName = "Person", LastName = "Person" + "." + 17, Age = 18 }, new STest { FirstName = "Person", LastName = "Person" + "." + 18, Age = 19 }, }; _jsonSerializer = new JsonTextSerializer(); _binData = _jsonSerializer.Serialize(_data); _jsonSerializerStream = new MemoryStream(); _jsonSerializer.Serialize(_data, _jsonSerializerStream); _xmlSerializer = new XmlTextSerializer(); _binData = _xmlSerializer.Serialize(_data); _xmlSerializerStream = new MemoryStream(); _xmlSerializer.Serialize(_data, _xmlSerializerStream); _binSerializer = new BinaryFormatterSerializer(); _binData = _binSerializer.Serialize(_data); _binSerializerStream = new MemoryStream(); _binSerializer.Serialize(_data, _binSerializerStream); _utf8jsonSerializer = new Utf8JsonTextSerializer(); _binData = _utf8jsonSerializer.Serialize(_data); _utf8jsonSerializerStream = new MemoryStream(); _utf8jsonSerializer.Serialize(_data, _utf8jsonSerializerStream); _msgPackSerializer = new MsgPackSerializer(); _binData = _msgPackSerializer.Serialize(_data); _msgPackSerializerStream = new MemoryStream(); _msgPackSerializer.Serialize(_data, _msgPackSerializerStream); _nBinary = new NBinarySerializer(); _binData = _nBinary.Serialize(_data); _nBinaryStream = new MemoryStream(); _nBinary.Serialize(_data, _nBinaryStream); _rawBinary = new RawBinarySerializer(); _binData = _rawBinary.Serialize(_data); _rawBinaryStream = new MemoryStream(); _rawBinary.Serialize(_data, _rawBinaryStream); }