-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
19 lines (17 loc) · 881 Bytes
/
Program.cs
File metadata and controls
19 lines (17 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
double ws = Environment.WorkingSet;
Run(new JsonUtfSerializer(), new Payloads.Json.Telemetries() { WorkingSet = ws });
Run(new CborSerializer(), new Payloads.Cbor.Telemetries() { WorkingSet = ws });
Run(new MsgPackSerializer(), new Payloads.MsgPack.Telemetries() { WorkingSet = ws });
Run(new ProtobufSerializer(Payloads.Proto.Telemetries.Parser), new Payloads.Proto.Telemetries() { WorkingSet = ws });
var inAvro = new Payloads.Avro.Telemetries() { WorkingSet = ws };
Run(new AvroSerializer(inAvro.Schema), inAvro);
static T Run<T>(PayloadBinarySerializer serializer, T payload)
{
Console.WriteLine(serializer.GetType().Name);
var bytes = serializer.ToBytes(payload);
Console.Write($"{bytes.Length} bytes: ");
bytes.ToList().ForEach(x => Console.Write($"0x{x} "));
Console.WriteLine();
Console.WriteLine();
return serializer.FromBytes<T>(bytes);
}