Skip to content

Commit 419e867

Browse files
committed
Refactor analysis engine
1 parent 58e6ae9 commit 419e867

377 files changed

Lines changed: 3506 additions & 3012 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Docs/Architecture - Numeric.drawio

Lines changed: 432 additions & 0 deletions
Large diffs are not rendered by default.

Docs/Architecture - String.drawio

Lines changed: 1342 additions & 0 deletions
Large diffs are not rendered by default.

Src/FastData.Benchmarks/Benchmarks/DeduplicationBenchmarks.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Genbox.FastData.Internal;
2+
13
namespace Genbox.FastData.Benchmarks.Benchmarks;
24

35
[MemoryDiagnoser]
@@ -20,22 +22,22 @@ public void HashSetDedup()
2022
{
2123
int[] keys = new int[_intKeys.Length];
2224
Array.Copy(_intKeys, keys, _intKeys.Length);
23-
FastDataGenerator.DeduplicateWithHashSet(keys, Array.Empty<int>(), false, EqualityComparer<int>.Default, out _);
25+
Deduplication.DeduplicateWithHashSet(keys, Array.Empty<int>(), false, EqualityComparer<int>.Default, out _);
2426
}
2527

2628
[Benchmark]
2729
public void SortDedup()
2830
{
2931
int[] keys = new int[_intKeys.Length];
3032
Array.Copy(_intKeys, keys, _intKeys.Length);
31-
FastDataGenerator.DeduplicateWithSort(keys, Array.Empty<int>(), false, EqualityComparer<int>.Default, Comparer<int>.Default, out _);
33+
Deduplication.DeduplicateWithSort(keys, Array.Empty<int>(), false, EqualityComparer<int>.Default, Comparer<int>.Default, out _);
3234
}
3335

3436
[Benchmark]
3537
public void SortPreserveDedup()
3638
{
3739
int[] keys = new int[_intKeys.Length];
3840
Array.Copy(_intKeys, keys, _intKeys.Length);
39-
FastDataGenerator.DeduplicateWithSortPreserveInputOrder(keys, Array.Empty<int>(), false, EqualityComparer<int>.Default, Comparer<int>.Default, out _);
41+
Deduplication.DeduplicateWithSortPreserveInputOrder(keys, Array.Empty<int>(), false, EqualityComparer<int>.Default, Comparer<int>.Default, out _);
4042
}
4143
}

Src/FastData.Benchmarks/Benchmarks/GPerfAnalyzerBenchmarks.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Genbox.FastData.Config.Analysis;
12
using Genbox.FastData.Enums;
23
using Genbox.FastData.Internal.Analysis;
34
using Genbox.FastData.Internal.Analysis.Analyzers;

Src/FastData.Benchmarks/Program.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
using BenchmarkDotNet.Jobs;
44
using BenchmarkDotNet.Running;
55
using BenchmarkDotNet.Validators;
6-
using Genbox.FastData.Extensions;
6+
using Genbox.FastData.Config;
7+
using Genbox.FastData.Enums;
78
using Genbox.FastData.Generator.CSharp;
89
using Genbox.FastData.Internal.Structures;
9-
using Genbox.FastData.InternalShared;
1010
using Genbox.FastData.InternalShared.Helpers;
11-
using Genbox.FastData.InternalShared.TestClasses;
1211

1312
namespace Genbox.FastData.Benchmarks;
1413

@@ -47,7 +46,7 @@ public static void GenerateFiles()
4746
// This code is used to generate the files in the Generated folder.
4847

4948
int[] sizes = [1, 5, 10, 50, 100, 500, 1000];
50-
Type[] structures = [typeof(ArrayStructure<,>), typeof(ConditionalStructure<,>), typeof(BinarySearchStructure<,>), typeof(BinarySearchStructure<,>), typeof(HashTableStructure<,>)];
49+
Type[] structures = [typeof(ArrayStructure<,>), typeof(ConditionalStructure<,>), typeof(BinarySearchStructure<,>), typeof(HashTableStructure<,>)];
5150

5251
foreach (Type type in structures)
5352
{
@@ -61,8 +60,12 @@ private static void DoStructure(Type type, int size)
6160
Random rng = new Random(42);
6261
string[] data = Enumerable.Range(0, size).Select(_ => TestHelper.GenerateRandomString(rng, rng.Next(5, 10))).ToArray();
6362

64-
TestVector<string> vector = new TestVector<string>(type, data, []);
65-
string source = TestGenerator.Generate(CSharpCodeGenerator.Create(new CSharpCodeGeneratorConfig("fastdata")), vector);
66-
File.WriteAllText("Gen-" + type.GetCleanName() + "-" + size + ".cs", source);
63+
CSharpCodeGenerator generator = CSharpCodeGenerator.Create(new CSharpCodeGeneratorConfig("fastdata"));
64+
65+
StringDataConfig config = new StringDataConfig();
66+
config.StructureTypeOverride = type;
67+
68+
string source = FastDataGenerator.Generate(data, config, generator);
69+
File.WriteAllText("Gen-" + type + "-" + size + ".cs", source);
6770
}
6871
}

Src/FastData.Cli/StructureType.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace Genbox.FastData.Cli;
2+
3+
public enum StructureType : byte
4+
{
5+
Auto = 0,
6+
7+
Array,
8+
BinarySearch,
9+
BinarySearchInterpolation,
10+
BitSet,
11+
BloomFilter,
12+
Conditional,
13+
EliasFano,
14+
HashTableCompact,
15+
HashTablePerfect,
16+
HashTable,
17+
KeyLength,
18+
Range,
19+
RrrBitVector,
20+
SingleValue
21+
}

Src/FastData.Examples/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Genbox.FastData.Config;
12
using Genbox.FastData.Generator.CSharp;
23

34
namespace Genbox.FastData.Examples;
@@ -6,7 +7,7 @@ internal static class Program
67
{
78
private static void Main()
89
{
9-
FastDataConfig config = new FastDataConfig();
10+
StringDataConfig config = new StringDataConfig();
1011
CSharpCodeGenerator generator = CSharpCodeGenerator.Create(new CSharpCodeGeneratorConfig("Dogs"));
1112

1213
string source = FastDataGenerator.Generate(["Labrador", "German Shepherd", "Golden Retriever"], config, generator);

Src/FastData.Generator.CPlusPlus.TestHarness/CPlusPlusBenchmark.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Genbox.FastData.Generator.Extensions;
22
using Genbox.FastData.InternalShared.Harness;
3+
using Genbox.FastData.InternalShared.Harness.Enums;
34
using Genbox.FastData.InternalShared.Helpers;
45
using Genbox.FastData.InternalShared.TestClasses;
56
using static System.Linq.Enumerable;

Src/FastData.Generator.CPlusPlus.TestHarness/CPlusPlusBootstrap.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Genbox.FastData.Generator.Framework;
44
using Genbox.FastData.Generators.Abstracts;
55
using Genbox.FastData.InternalShared.Harness;
6+
using Genbox.FastData.InternalShared.Harness.Enums;
67

78
namespace Genbox.FastData.Generator.CPlusPlus.TestHarness;
89

0 commit comments

Comments
 (0)