Skip to content

Commit cf9805f

Browse files
committed
Cleanup
1 parent 2af6439 commit cf9805f

19 files changed

Lines changed: 60 additions & 59 deletions

File tree

FastData.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<File Path="Docs/Architecture/EarlyExits.md" />
3939
<File Path="Docs/Architecture/Generators.md" />
4040
<File Path="Docs/Architecture/Hashing.md" />
41+
<File Path="Docs/Architecture/StringEquality.md" />
4142
</Folder>
4243
<Folder Name="/_Docs/Development/">
4344
<File Path="Docs/Development/CreatingEarlyExits.md" />

Src/FastData.BenchmarkHarness.Runner/Application.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public async Task<int> RunAsync(Settings settings, CancellationToken cancellatio
3333
settings.Workload,
3434
settings.MaxError).ToArray();
3535

36-
ITestData[] benchmarkData = [..structureBenchmarks, ..earlyExitBenchmarks];
36+
ITestData[] benchmarkData = [.. structureBenchmarks, .. earlyExitBenchmarks];
3737
ResultStore resultStore = new ResultStore(settings.ResultsDirectory);
3838

3939
return settings.Mode switch
@@ -154,7 +154,7 @@ private static (string Label, string Value)[] GetExtraRows(Settings settings)
154154
("Loop", $"Warmup: {settings.WarmupCount.ToString(NumberFormatInfo.InvariantInfo)}, Samples: {settings.MinSampleCount.ToString(NumberFormatInfo.InvariantInfo)}-{settings.MaxSampleCount.ToString(NumberFormatInfo.InvariantInfo)}, Target: {settings.TargetIterationTimeMs.ToString(NumberFormatInfo.InvariantInfo)}ms, MaxError: {settings.MaxError.ToString(NumberFormatInfo.InvariantInfo)}%")
155155
];
156156

157-
return settings.Debug ? [..rows, ("Debug", "Enabled")] : rows;
157+
return settings.Debug ? [.. rows, ("Debug", "Enabled")] : rows;
158158
}
159159

160160
private static int WriteNoBenchmarksMatched(Settings settings)

Src/FastData.BenchmarkHarness.Runner/Environment/RunEnvironment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public static RunEnvironment Apply(EnvironmentSettings settings, (string Label,
4242

4343
if (!WindowsPowerPlan.IsSupported)
4444
{
45-
ConsoleOutput.WriteBenchmarkSetup([osRow, cpuCountRow, ("Power plan", "skipped (not Windows)"), cpuRow, ..extraRows]);
45+
ConsoleOutput.WriteBenchmarkSetup([osRow, cpuCountRow, ("Power plan", "skipped (not Windows)"), cpuRow, .. extraRows]);
4646
return new RunEnvironment(null);
4747
}
4848

4949
WindowsPowerPlanState state = WindowsPowerPlan.Apply(settings.PowerPlan);
50-
ConsoleOutput.WriteBenchmarkSetup([osRow, cpuCountRow, ("Power plan", state.PowerPlanDisplay), ("Processor AC", state.ProcessorAcDisplay), cpuRow, ..extraRows]);
50+
ConsoleOutput.WriteBenchmarkSetup([osRow, cpuCountRow, ("Power plan", state.PowerPlanDisplay), ("Processor AC", state.ProcessorAcDisplay), cpuRow, .. extraRows]);
5151
return new RunEnvironment(state);
5252
}
5353
}

Src/FastData.Benchmarks/Benchmarks/DeduplicationBenchmarks.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ public class DeduplicationBenchmarks
1111
private const int RangeSize = 200;
1212
private const int BitSetCount = 16_384;
1313
private const int BitSetRangeStep = 97;
14-
15-
private byte[] _rangeUInt8Keys = null!;
16-
private sbyte[] _rangeInt8Keys = null!;
14+
private int[] _bitSetInt32Keys = null!;
15+
private long[] _bitSetInt64Keys = null!;
16+
private uint[] _bitSetUInt32Keys = null!;
17+
private ulong[] _bitSetUInt64Keys = null!;
1718
private char[] _rangeCharKeys = null!;
1819
private short[] _rangeInt16Keys = null!;
19-
private ushort[] _rangeUInt16Keys = null!;
2020
private int[] _rangeInt32Keys = null!;
21-
private uint[] _rangeUInt32Keys = null!;
2221
private long[] _rangeInt64Keys = null!;
22+
private sbyte[] _rangeInt8Keys = null!;
23+
private ushort[] _rangeUInt16Keys = null!;
24+
private uint[] _rangeUInt32Keys = null!;
2325
private ulong[] _rangeUInt64Keys = null!;
24-
private int[] _bitSetInt32Keys = null!;
25-
private uint[] _bitSetUInt32Keys = null!;
26-
private long[] _bitSetInt64Keys = null!;
27-
private ulong[] _bitSetUInt64Keys = null!;
26+
27+
private byte[] _rangeUInt8Keys = null!;
2828

2929
[GlobalSetup]
3030
public void Setup()
@@ -45,7 +45,7 @@ public void Setup()
4545

4646
for (int i = 0; i < RangeCount; i++)
4747
{
48-
int value = i * 997 % RangeSize;
48+
int value = (i * 997) % RangeSize;
4949
_rangeUInt8Keys[i] = (byte)value;
5050
_rangeInt8Keys[i] = (sbyte)(value - 100);
5151
_rangeCharKeys[i] = (char)value;
@@ -59,7 +59,7 @@ public void Setup()
5959

6060
for (int i = 0; i < BitSetCount; i++)
6161
{
62-
int value = i % (BitSetCount / 2) * BitSetRangeStep;
62+
int value = (i % (BitSetCount / 2)) * BitSetRangeStep;
6363
_bitSetInt32Keys[i] = value - 100_000;
6464
_bitSetUInt32Keys[i] = (uint)value + 1_000_000u;
6565
_bitSetInt64Keys[i] = value - 100_000L;

Src/FastData.Benchmarks/Benchmarks/DeduplicationDispatchBenchmarks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void Setup()
2121

2222
for (int i = 0; i < Count; i++)
2323
{
24-
int value = i * 997 % 200;
24+
int value = (i * 997) % 200;
2525
_byteKeys[i] = (byte)value;
2626
_uint16Keys[i] = (ushort)(10000 + value);
2727
}

Src/FastData.Benchmarks/Benchmarks/IntegerEncodingBenchmarks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ namespace Genbox.FastData.Benchmarks.Benchmarks;
1212
public class IntegerEncodingBenchmarks
1313
{
1414
private readonly byte[] _encoded = new byte[10 * 4096];
15-
private readonly int[] _offsets = new int[4096];
1615
private readonly int[] _lengths = new int[4096];
16+
private readonly int[] _offsets = new int[4096];
1717
private IIntegerEncoding _encoding = null!;
1818
private ulong[] _values = null!;
1919

Src/FastData.Benchmarks/Benchmarks/KeyAnalyzerBenchmarks.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ public class KeyAnalyzerBenchmarks
99
{
1010
private readonly string[] _data;
1111

12-
[Params(GeneratorEncoding.Utf16CodeUnits, GeneratorEncoding.Utf8Bytes)]
13-
public GeneratorEncoding Encoding { get; set; }
14-
1512
public KeyAnalyzerBenchmarks()
1613
{
1714
Random rng = new Random(42);
1815
_data = Enumerable.Range(1, 100).Select(_ => TestHelper.GenerateRandomString(rng, 50)).ToArray();
1916
}
2017

18+
[Params(GeneratorEncoding.Utf16CodeUnits, GeneratorEncoding.Utf8Bytes)]
19+
public GeneratorEncoding Encoding { get; set; }
20+
2121
[Benchmark]
2222
public object GetStringProperties() => KeyAnalyzer.GetStringProperties(_data, false, Encoding);
2323
}

Src/FastData.Benchmarks/Benchmarks/NumericEarlyExitBenchmarks.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ namespace Genbox.FastData.Benchmarks.Benchmarks;
88
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
99
public class NumericEarlyExitBenchmarks
1010
{
11-
private int _min = 3;
12-
private int _max = 42;
13-
private int _value = 7;
14-
private byte _byteMin = 42;
1511
private byte _byteMax = 100;
12+
private byte _byteMin = 42;
1613
private byte _byteValue = 41;
17-
private sbyte _sbyteMin = -10;
14+
private int _max = 42;
15+
private int _min = 3;
1816
private sbyte _sbyteMax = 20;
17+
private sbyte _sbyteMin = -10;
1918
private sbyte _sbyteValue = -11;
2019
private Vector256<int> _simdSet = Vector256.Create(3, 5, 7, 11, 13, 17, 19, 23);
20+
private int _value = 7;
2121

2222
[Benchmark]public bool ValueRange() => _value < _min || _value > _max;
2323

Src/FastData.Benchmarks/Benchmarks/SimulatorBenchmarks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public class SimulatorBenchmarks
1919
private BruteForceStringHash _bruteForceHash = null!;
2020
private string[] _keys = null!;
2121
private StringKeyProperties _properties = null!;
22-
private IStringHash _stringHash = null!;
2322
private Simulator _simulator = null!;
23+
private IStringHash _stringHash = null!;
2424

2525
[Params(32, 256, 1000, 10000)]
2626
public int Count { get; set; }
@@ -33,7 +33,7 @@ public void Setup()
3333
for (int i = 0; i < _keys.Length; i++)
3434
_keys[i] = $"key-{i:D8}-abcdefghijklmnopqrstuvwxyz";
3535

36-
_stringHash = DefaultStringHash.GetInstance(GeneratorEncoding.Utf8Bytes, false);
36+
_stringHash = DefaultStringHash.GetInstance(GeneratorEncoding.Utf8Bytes);
3737
_properties = KeyAnalyzer.GetStringProperties(_keys, false, GeneratorEncoding.Utf8Bytes);
3838
_bruteForceHash = new BruteForceStringHash(new ArraySegment(0, 8, Alignment.Left), Mix, static hash => hash);
3939
_simulator = new Simulator(_keys, GeneratorEncoding.Utf8Bytes);

Src/FastData.Benchmarks/Benchmarks/StringEarlyExitBenchmarks.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ namespace Genbox.FastData.Benchmarks.Benchmarks;
77
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
88
public class StringEarlyExitBenchmarks
99
{
10-
private string _value = "hello world";
11-
private int _min = 3;
12-
private int _max = 42;
1310
private ulong[] _bitset = [2828, 4848];
1411
private ulong _firstLow = 60;
1512
private ulong _lastLow = 60;
13+
private int _max = 42;
14+
private int _min = 3;
1615
private ulong _stringMask = 0xFF93FF93FF9AFF97UL;
16+
private string _value = "hello world";
1717

1818
[Benchmark]public bool LengthEqual() => _value.Length != 49;
1919

0 commit comments

Comments
 (0)