mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-06-13 14:38:43 +00:00
GVWIE
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Esiur.Tests.Gvwie
|
||||
Negative,
|
||||
Alternating,
|
||||
Small,
|
||||
Medium,
|
||||
Ascending,
|
||||
Clustering,
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public static class IntArrayGenerator
|
||||
/// - minGap / maxGap: approximate gap between runs (large gaps produce the jump examples)
|
||||
/// </summary>
|
||||
///
|
||||
public static void InitRng(int seed= 24241564) => rng = new Random(seed);
|
||||
public static void InitRng(int seed = 24241564) => rng = new Random(seed);
|
||||
|
||||
public static long[] GenerateRuns(int length,
|
||||
int minRunSize = 3,
|
||||
@@ -140,6 +140,17 @@ public static class IntArrayGenerator
|
||||
data[i] = rng.Next(0, int.MaxValue);
|
||||
break;
|
||||
|
||||
case GeneratorPattern.Medium:
|
||||
for (int i = 0; i < length; i++)
|
||||
data[i] = rng.Next(0, short.MaxValue);
|
||||
break;
|
||||
|
||||
//case GeneratorPattern.Large:
|
||||
// for (int i = 0; i < length; i++)
|
||||
// data[i] = rng.Next(0, int.MaxValue);
|
||||
// break;
|
||||
|
||||
|
||||
case GeneratorPattern.Negative:
|
||||
for (int i = 0; i < length; i++)
|
||||
data[i] = -rng.Next(int.MinValue, 0);
|
||||
@@ -156,7 +167,8 @@ public static class IntArrayGenerator
|
||||
case GeneratorPattern.Small:
|
||||
// Focused on small magnitudes to test ZigZag fast path
|
||||
for (int i = 0; i < length; i++)
|
||||
data[i] = rng.Next(-64, 65);
|
||||
//data[i] = rng.Next(-64, 65);
|
||||
data[i] = rng.Next(sbyte.MinValue, sbyte.MaxValue);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Esiur.Tests.Gvwie
|
||||
public void Run()
|
||||
{
|
||||
|
||||
const int TEST_ITERATIONS = 100;
|
||||
const int TEST_ITERATIONS = 10;
|
||||
const int SAMPLE_SIZE = 100;
|
||||
|
||||
Console.WriteLine(",Esiur,Aligned,FlatBuffer,ProtoBuffer,MessagePack,BSON,CBOR,Avro,Optimal");
|
||||
@@ -41,15 +41,15 @@ namespace Esiur.Tests.Gvwie
|
||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Clustering)), TEST_ITERATIONS)
|
||||
);
|
||||
|
||||
Console.Write("Positive (Int32);");
|
||||
Console.Write("Large (Int32);");
|
||||
|
||||
PrintAverage(
|
||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Uniform)), TEST_ITERATIONS)
|
||||
);
|
||||
|
||||
Console.Write("Negative (Int32);");
|
||||
Console.Write("Medium (Int32);");
|
||||
PrintAverage(
|
||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Negative)), TEST_ITERATIONS)
|
||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Medium)), TEST_ITERATIONS)
|
||||
);
|
||||
|
||||
Console.Write("Small (Int32);");
|
||||
@@ -57,6 +57,15 @@ namespace Esiur.Tests.Gvwie
|
||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Small)), TEST_ITERATIONS)
|
||||
);
|
||||
|
||||
|
||||
Console.Write("Negative (Int32);");
|
||||
PrintAverage(
|
||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Negative)), TEST_ITERATIONS)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
Console.Write("Alternating (Int32);");
|
||||
PrintAverage(
|
||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Alternating)), TEST_ITERATIONS)
|
||||
@@ -68,6 +77,10 @@ namespace Esiur.Tests.Gvwie
|
||||
Average(() => CompareInt(IntArrayGenerator.GenerateInt32(SAMPLE_SIZE, GeneratorPattern.Ascending)), TEST_ITERATIONS)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Console.Write("Int64;");
|
||||
|
||||
PrintAverage(
|
||||
@@ -450,7 +463,7 @@ namespace Esiur.Tests.Gvwie
|
||||
|
||||
public static byte[] SerializeFlatBuffers<T>(ArrayRoot<T> array)
|
||||
{
|
||||
var buffer = new byte[1000000000];
|
||||
var buffer = new byte[1000000];
|
||||
var len = FlatBufferSerializer.Default.Serialize(array, buffer);
|
||||
return buffer.Take(len).ToArray();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ MessagePack.MessagePackSerializer.DefaultOptions = MessagePackSerializerOptions.
|
||||
var ints = new IntArrayRunner();
|
||||
IntArrayGenerator.InitRng();
|
||||
ints.Run();
|
||||
IntArrayGenerator.InitRng();
|
||||
ints.RunChart();
|
||||
//IntArrayGenerator.InitRng();
|
||||
//ints.RunChart();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user