mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-04-29 06:48:41 +00:00
example
This commit is contained in:
@@ -32,8 +32,7 @@ namespace Esiur.Tests.Gvwie
|
|||||||
const int TEST_ITERATIONS = 100;
|
const int TEST_ITERATIONS = 100;
|
||||||
const int SAMPLE_SIZE = 100;
|
const int SAMPLE_SIZE = 100;
|
||||||
|
|
||||||
Console.WriteLine(";Esiur;Aligned;FlatBuffer;ProtoBuffer,MessagePack;BSON;CBOR;Avro,Optimal");
|
Console.WriteLine(",Esiur,Aligned,FlatBuffer,ProtoBuffer,MessagePack,BSON,CBOR,Avro,Optimal");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Console.Write("Cluster (Int32);");
|
Console.Write("Cluster (Int32);");
|
||||||
@@ -57,11 +56,8 @@ namespace Esiur.Tests.Gvwie
|
|||||||
PrintAverage(
|
PrintAverage(
|
||||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Small)), TEST_ITERATIONS)
|
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Small)), TEST_ITERATIONS)
|
||||||
);
|
);
|
||||||
// CompareInt(int32small);
|
|
||||||
|
|
||||||
Console.Write("Alternating (Int32);");
|
Console.Write("Alternating (Int32);");
|
||||||
//CompareInt(int32alter);
|
|
||||||
|
|
||||||
PrintAverage(
|
PrintAverage(
|
||||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Alternating)), TEST_ITERATIONS)
|
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Alternating)), TEST_ITERATIONS)
|
||||||
);
|
);
|
||||||
@@ -423,7 +419,7 @@ namespace Esiur.Tests.Gvwie
|
|||||||
sum.Average(x => x.Item9)
|
sum.Average(x => x.Item9)
|
||||||
};
|
};
|
||||||
|
|
||||||
Console.WriteLine($"{rt[0]};{rt[1]};{rt[2]};{rt[3]};{rt[4]};{rt[5]};{rt[6]};{rt[7]};{rt[8]}");
|
Console.WriteLine($"{rt[0]},{rt[1]},{rt[2]},{rt[3]},{rt[4]},{rt[5]},{rt[6]},{rt[7]},{rt[8]}");
|
||||||
|
|
||||||
|
|
||||||
return rt;
|
return rt;
|
||||||
|
|||||||
@@ -3,29 +3,26 @@ using Esiur.Data.Gvwie;
|
|||||||
using Esiur.Tests.Gvwie;
|
using Esiur.Tests.Gvwie;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
|
|
||||||
var e = GroupInt32Codec.Encode(new int[] {-12000, 15000, -1, 32760 });
|
//var e = GroupInt32Codec.Encode(new int[] {-12000, 15000, -1, 32760 });
|
||||||
|
|
||||||
|
var s = new int[] { 1, -1, 2, 300, 301, 200,1, 302 };
|
||||||
|
|
||||||
|
var e = GroupInt32Codec.Encode(s);
|
||||||
|
|
||||||
|
var d = GroupInt32Codec.Decode(e);
|
||||||
|
|
||||||
|
if (d.SequenceEqual(s))
|
||||||
|
Console.WriteLine("Example passed.");
|
||||||
|
|
||||||
var test = IntArrayGenerator.GenerateInt32(5000, GeneratorPattern.Uniform);
|
var test = IntArrayGenerator.GenerateInt32(5000, GeneratorPattern.Uniform);
|
||||||
|
|
||||||
var aligned = GroupInt32Codec.Encode(test, true);
|
|
||||||
var nonAligned = GroupInt32Codec.Encode(test, false);
|
|
||||||
|
|
||||||
var result1 = GroupInt32Codec.Decode(aligned);
|
|
||||||
var result2 = GroupInt32Codec.Decode(nonAligned);
|
|
||||||
|
|
||||||
if (result1.SequenceEqual(result2))
|
|
||||||
Console.WriteLine($"Passed {aligned.Length}");
|
|
||||||
|
|
||||||
if (result1.SequenceEqual(test))
|
|
||||||
Console.WriteLine($"Passed {nonAligned.Length}");
|
|
||||||
|
|
||||||
MessagePack.MessagePackSerializer.DefaultOptions = MessagePackSerializerOptions.Standard
|
MessagePack.MessagePackSerializer.DefaultOptions = MessagePackSerializerOptions.Standard
|
||||||
.WithCompression(MessagePackCompression.None); // optional; remove if you want raw size
|
.WithCompression(MessagePackCompression.None); // optional; remove if you want raw size
|
||||||
|
|
||||||
|
|
||||||
var ints = new IntArrayRunner();
|
var ints = new IntArrayRunner();
|
||||||
//IntArrayGenerator.InitRng();
|
IntArrayGenerator.InitRng();
|
||||||
//ints.Run();
|
ints.Run();
|
||||||
IntArrayGenerator.InitRng();
|
IntArrayGenerator.InitRng();
|
||||||
ints.RunChart();
|
ints.RunChart();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user