Skip to content

Commit 1abae3f

Browse files
committed
Add benchmarks for QPS
1 parent 59e6f11 commit 1abae3f

27 files changed

+2079
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System.Globalization;
2+
using BenchmarkDotNet.Columns;
3+
using BenchmarkDotNet.Configs;
4+
5+
namespace Genbox.FastData.Benchmarks.Docs;
6+
7+
/// <summary>
8+
/// Used in docs. Graph is generated on https://www.canva.com/
9+
/// </summary>
10+
[Config(typeof(Config))]
11+
public class QPSBenchmarks
12+
{
13+
private class Config : ManualConfig
14+
{
15+
public Config()
16+
{
17+
AddColumn(StatisticColumn.OperationsPerSecond);
18+
HideColumns("Error", "StdDev");
19+
}
20+
}
21+
22+
[Benchmark] public bool Array1() => ArrayStructure_String_1.Contains(GetQuery());
23+
[Benchmark] public bool Array5() => ArrayStructure_String_5.Contains(GetQuery());
24+
[Benchmark] public bool Array10() => ArrayStructure_String_10.Contains(GetQuery());
25+
[Benchmark] public bool Array50() => ArrayStructure_String_50.Contains(GetQuery());
26+
[Benchmark] public bool Array100() => ArrayStructure_String_100.Contains(GetQuery());
27+
[Benchmark] public bool Array500() => ArrayStructure_String_500.Contains(GetQuery());
28+
29+
[Benchmark] public bool BinarySearch1() => BinarySearchStructure_String_1.Contains(GetQuery());
30+
[Benchmark] public bool BinarySearch5() => BinarySearchStructure_String_5.Contains(GetQuery());
31+
[Benchmark] public bool BinarySearch10() => BinarySearchStructure_String_10.Contains(GetQuery());
32+
[Benchmark] public bool BinarySearch50() => BinarySearchStructure_String_50.Contains(GetQuery());
33+
[Benchmark] public bool BinarySearch100() => BinarySearchStructure_String_100.Contains(GetQuery());
34+
[Benchmark] public bool BinarySearch500() => BinarySearchStructure_String_500.Contains(GetQuery());
35+
36+
[Benchmark] public bool Conditional1() => ConditionalStructure_String_1.Contains(GetQuery());
37+
[Benchmark] public bool Conditional5() => ConditionalStructure_String_5.Contains(GetQuery());
38+
[Benchmark] public bool Conditional10() => ConditionalStructure_String_10.Contains(GetQuery());
39+
[Benchmark] public bool Conditional50() => ConditionalStructure_String_50.Contains(GetQuery());
40+
[Benchmark] public bool Conditional100() => ConditionalStructure_String_100.Contains(GetQuery());
41+
[Benchmark] public bool Conditional500() => ConditionalStructure_String_500.Contains(GetQuery());
42+
43+
[Benchmark] public bool HashTable1() => HashTableStructure_String_1.Contains(GetQuery());
44+
[Benchmark] public bool HashTable5() => HashTableStructure_String_5.Contains(GetQuery());
45+
[Benchmark] public bool HashTable10() => HashTableStructure_String_10.Contains(GetQuery());
46+
[Benchmark] public bool HashTable50() => HashTableStructure_String_50.Contains(GetQuery());
47+
[Benchmark] public bool HashTable100() => HashTableStructure_String_100.Contains(GetQuery());
48+
[Benchmark] public bool HashTable500() => HashTableStructure_String_500.Contains(GetQuery());
49+
50+
private static string GetQuery() => Random.Shared.Next(0, 1_000_000).ToString(NumberFormatInfo.InvariantInfo);
51+
}

Src/FastData.Benchmarks/FastData.Benchmarks.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18+
<ProjectReference Include="..\FastData.Generator.CSharp\FastData.Generator.CSharp.csproj" />
1819
<ProjectReference Include="..\FastData.InternalShared\FastData.InternalShared.csproj" />
1920
</ItemGroup>
2021

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: Array
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class ArrayStructure_String_1
10+
{
11+
private static readonly string[] _keys = new string[] {
12+
"IHgKQsfK"
13+
};
14+
15+
16+
public static bool Contains(string key)
17+
{
18+
19+
20+
for (int i = 0; i < 1; i++)
21+
{
22+
if (StringComparer.Ordinal.Equals(key, _keys[i]))
23+
return true;
24+
}
25+
return false;
26+
}
27+
28+
public const uint ItemCount = 1;
29+
public const uint MinKeyLength = 8;
30+
public const uint MaxKeyLength = 8;
31+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: Array
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class ArrayStructure_String_10
10+
{
11+
private static readonly string[] _keys = new string[] {
12+
"IHgKQsfK", "OPfTXQgC", "jYJFryhCs", "4qgLC", "kyAhxu", "JBDwmH", "vRoICl", "DarmNAW", "EsEcAx", "feAzAAD"
13+
};
14+
15+
16+
public static bool Contains(string key)
17+
{
18+
if (key.Length < 5u || key.Length > 9u)
19+
return false;
20+
21+
for (int i = 0; i < 10; i++)
22+
{
23+
if (StringComparer.Ordinal.Equals(key, _keys[i]))
24+
return true;
25+
}
26+
return false;
27+
}
28+
29+
public const uint ItemCount = 10;
30+
public const uint MinKeyLength = 5;
31+
public const uint MaxKeyLength = 9;
32+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: Array
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class ArrayStructure_String_100
10+
{
11+
private static readonly string[] _keys = new string[] {
12+
"IHgKQsfK", "OPfTXQgC", "jYJFryhCs", "4qgLC", "kyAhxu", "JBDwmH", "vRoICl", "DarmNAW", "EsEcAx", "feAzAAD",
13+
"C45cXmCX", "bxhYS", "ktB27UsKG", "UwJINkf", "vpsRi9oBV", "BNQCNkaF9", "GTUuz", "C03O5", "RhnmLSLBO", "9wI2LSiis",
14+
"lY2bV", "ch6yHGAL6", "ZkYH473K", "hm6yuR", "gxP3pL", "OznFax", "w76c38JkN", "frGxVgsM", "wkM5DDN", "KSQ2dW",
15+
"vp9W1TL", "klY7Ed2T4", "3BSjB3Zpo", "S6uBVoCqg", "VNlnlT", "GI0S8VAj", "JLnG6L", "Mno1Wmaa", "xihpZ", "8rNThyrT",
16+
"ub9f1CZ", "KiZA7cT", "sZFLxc4", "fM62nn0fU", "G4m5j", "XIXGA", "BO4zzYlH", "RhDAoFgw", "s3p3VZ1", "06ypFx50",
17+
"s7xyb", "MQyWj44D0", "0YG8I2", "8BioTIM", "HJcXi8sR", "dmgCR2527", "OZz2Dz", "zw3P2Im", "cvcqRWIH", "efVdq",
18+
"mwVy7", "RRZiGI", "Xuld4azGd", "q6GSsX", "d9JnQdg", "pRKeCH", "NNtW3", "bC1CJ", "p11Ci31", "H9SHQ",
19+
"JPJom", "Efs2jWe", "C6SkG40", "xOlkKCC", "4lFy2L", "NZseKI8dM", "WCLrsAW", "qb5CCP", "ce87Q", "m0DEKXZq",
20+
"zuZKyA", "hMktkMu7K", "dcroAf", "ttMHmhn7h", "mKn2bB", "6vXgFaG", "4x479", "yPcaEyu4", "7wDyHxhe", "aGrPI",
21+
"oTGAsts", "hsy5KcWNz", "FZuCl", "TWT2g27jG", "vvsuM", "OwfGT1WCp", "RpJspm", "HrVa0dpu", "yIqkfF", "JL8gepb9R"
22+
};
23+
24+
25+
public static bool Contains(string key)
26+
{
27+
if (key.Length < 5u || key.Length > 9u)
28+
return false;
29+
30+
for (int i = 0; i < 100; i++)
31+
{
32+
if (StringComparer.Ordinal.Equals(key, _keys[i]))
33+
return true;
34+
}
35+
return false;
36+
}
37+
38+
public const uint ItemCount = 100;
39+
public const uint MinKeyLength = 5;
40+
public const uint MaxKeyLength = 9;
41+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: Array
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class ArrayStructure_String_5
10+
{
11+
private static readonly string[] _keys = new string[] {
12+
"IHgKQsfK", "OPfTXQgC", "jYJFryhCs", "4qgLC", "kyAhxu"
13+
};
14+
15+
16+
public static bool Contains(string key)
17+
{
18+
if ((432UL & (1UL << (key.Length - 1))) == 0)
19+
return false;
20+
21+
for (int i = 0; i < 5; i++)
22+
{
23+
if (StringComparer.Ordinal.Equals(key, _keys[i]))
24+
return true;
25+
}
26+
return false;
27+
}
28+
29+
public const uint ItemCount = 5;
30+
public const uint MinKeyLength = 5;
31+
public const uint MaxKeyLength = 9;
32+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: Array
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class ArrayStructure_String_50
10+
{
11+
private static readonly string[] _keys = new string[] {
12+
"IHgKQsfK", "OPfTXQgC", "jYJFryhCs", "4qgLC", "kyAhxu", "JBDwmH", "vRoICl", "DarmNAW", "EsEcAx", "feAzAAD",
13+
"C45cXmCX", "bxhYS", "ktB27UsKG", "UwJINkf", "vpsRi9oBV", "BNQCNkaF9", "GTUuz", "C03O5", "RhnmLSLBO", "9wI2LSiis",
14+
"lY2bV", "ch6yHGAL6", "ZkYH473K", "hm6yuR", "gxP3pL", "OznFax", "w76c38JkN", "frGxVgsM", "wkM5DDN", "KSQ2dW",
15+
"vp9W1TL", "klY7Ed2T4", "3BSjB3Zpo", "S6uBVoCqg", "VNlnlT", "GI0S8VAj", "JLnG6L", "Mno1Wmaa", "xihpZ", "8rNThyrT",
16+
"ub9f1CZ", "KiZA7cT", "sZFLxc4", "fM62nn0fU", "G4m5j", "XIXGA", "BO4zzYlH", "RhDAoFgw", "s3p3VZ1", "06ypFx50"
17+
};
18+
19+
20+
public static bool Contains(string key)
21+
{
22+
if (key.Length < 5u || key.Length > 9u)
23+
return false;
24+
25+
for (int i = 0; i < 50; i++)
26+
{
27+
if (StringComparer.Ordinal.Equals(key, _keys[i]))
28+
return true;
29+
}
30+
return false;
31+
}
32+
33+
public const uint ItemCount = 50;
34+
public const uint MinKeyLength = 5;
35+
public const uint MaxKeyLength = 9;
36+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: Array
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class ArrayStructure_String_500
10+
{
11+
private static readonly string[] _keys = new string[] {
12+
"IHgKQsfK", "OPfTXQgC", "jYJFryhCs", "4qgLC", "kyAhxu", "JBDwmH", "vRoICl", "DarmNAW", "EsEcAx", "feAzAAD",
13+
"C45cXmCX", "bxhYS", "ktB27UsKG", "UwJINkf", "vpsRi9oBV", "BNQCNkaF9", "GTUuz", "C03O5", "RhnmLSLBO", "9wI2LSiis",
14+
"lY2bV", "ch6yHGAL6", "ZkYH473K", "hm6yuR", "gxP3pL", "OznFax", "w76c38JkN", "frGxVgsM", "wkM5DDN", "KSQ2dW",
15+
"vp9W1TL", "klY7Ed2T4", "3BSjB3Zpo", "S6uBVoCqg", "VNlnlT", "GI0S8VAj", "JLnG6L", "Mno1Wmaa", "xihpZ", "8rNThyrT",
16+
"ub9f1CZ", "KiZA7cT", "sZFLxc4", "fM62nn0fU", "G4m5j", "XIXGA", "BO4zzYlH", "RhDAoFgw", "s3p3VZ1", "06ypFx50",
17+
"s7xyb", "MQyWj44D0", "0YG8I2", "8BioTIM", "HJcXi8sR", "dmgCR2527", "OZz2Dz", "zw3P2Im", "cvcqRWIH", "efVdq",
18+
"mwVy7", "RRZiGI", "Xuld4azGd", "q6GSsX", "d9JnQdg", "pRKeCH", "NNtW3", "bC1CJ", "p11Ci31", "H9SHQ",
19+
"JPJom", "Efs2jWe", "C6SkG40", "xOlkKCC", "4lFy2L", "NZseKI8dM", "WCLrsAW", "qb5CCP", "ce87Q", "m0DEKXZq",
20+
"zuZKyA", "hMktkMu7K", "dcroAf", "ttMHmhn7h", "mKn2bB", "6vXgFaG", "4x479", "yPcaEyu4", "7wDyHxhe", "aGrPI",
21+
"oTGAsts", "hsy5KcWNz", "FZuCl", "TWT2g27jG", "vvsuM", "OwfGT1WCp", "RpJspm", "HrVa0dpu", "yIqkfF", "JL8gepb9R",
22+
"TlRZX", "JDkC0f", "T0WECO", "FrL09h", "FMbPVJoK", "czbug", "4C8oxoq", "lYv5G", "ZbZ0qD1J", "eWtJw3Ol",
23+
"zixI1Vt", "ZE00k", "hinAZk", "cpvPd", "Ef3OWx", "GiyQkE", "oowS6", "ILkI3zBYW", "B3XDpgfze", "SH9uW",
24+
"Ucax2cT", "J25vVgv", "tpwXMBcHJ", "y2mAM0vde", "7iAiky3", "lte7SYYT", "9NTATo5oa", "IqEA2CM5L", "NxXHpfZc", "kNm22wPKh",
25+
"4E4J1uGg", "m5FcMouL", "MUxOcx0sg", "MNm1pRRk", "ogWj9q", "5fvZOHkZ8", "1plGTJ", "STf9Ea", "5DahT", "vxim1U7Gi",
26+
"nM2bZ", "9MUWHQpK", "1FjeLrCGI", "DH8O8LI", "P2wL8vTD", "M6reIX", "APXlWXkG", "AVeA8WL9", "aSDqHxK", "dzJb7",
27+
"tMOsygY1R", "b8ZzDPzv", "8rFsUIja", "4u7SCa", "xtoXcIiA", "OIXVEN", "Xs9Nne3kO", "J7gtI", "9EPgLYQ0J", "UF9LF",
28+
"rujkD", "HT0EIW", "leoFNYRzr", "9cJEiJxkC", "AQvJi", "w66qHP31h", "qAwxyU9", "kH4IjJCdG", "7UsegU", "V2AqtiRg",
29+
"dxyPMqQyj", "8oWwnnJ", "4M2LdbL", "b8Q0jml", "qOp0JRE4", "FW88GXCjA", "UFRTWE", "ORis1VCu", "Y8SYm", "8RXFN",
30+
"VlNRiPR", "Z5TwZCx", "MOB5NA", "EQluLGA5R", "O3pVbSFvN", "dog8jVmE", "DRQUn", "A6fFa", "9B5LJHA", "55KATeZu",
31+
"K0e5wNj7", "CMaWjpx", "enkxaN", "UOIHQBIs", "TUO5eN", "WNkFxUjVe", "CAwKzt", "1lhFcrh3", "KCPa1xR", "Ok0Iz9pwm",
32+
"9I6Fe", "lD3ps4f", "LTJgG", "WPt76", "3eCl2S", "oivhEhoyx", "lGTEx7gzI", "iqtZ9JPr", "BRwaE", "eavE8cPiV",
33+
"0mJFh", "vumR8yW", "5S7rwmz", "POTguuJN", "HYRIgF", "kefCxw2q", "MJqfh", "sSKX5wAv", "lY80Z", "aYNVH",
34+
"Gx2cVm", "ildsvVp", "8JJyjsfbY", "CQAwudJae", "eR4kJiNZ", "pNetE", "ODghjlW", "nSVcv09", "U0DeqPj", "BeGTslih",
35+
"UgZn35BIx", "RxGciI", "2npjv", "d1gEeDvCu", "gaUj5b5CW", "8R15ChKls", "1Vjg6vW0g", "COg9j", "OiLas", "N2BMAlC7",
36+
"JT07L0xnJ", "FgQ0t", "2V9TmaSM", "Hreuvv", "iN34qBXLa", "BVmG7BRbI", "CoQsBo", "DIT3YTR7", "6zE08", "2rY6jHKqN",
37+
"ngu47K", "CRUCHBnCV", "4EcXR", "OviTEF", "3cFkuwgD", "v5Cjn", "vpv4N7Pl", "5VPgIY1y", "obkBa2PyF", "ShUsndA2i",
38+
"1on1V", "ZhA4q4GF", "MKtP2oZ2a", "NknmCI", "SoE9xsq", "dsxLIYaP", "aSRnpgcw", "iHEv48", "KlcA5ZbC", "Y5lqR4x",
39+
"0Lu12m", "mMjKj", "sxzZ8w7O", "B0OKRk1G6", "Us4tO4S9", "YtzRdw", "IvQTIzH9", "3msVh", "GnfP9xEl", "pwm0HLi",
40+
"XkbFznge", "5iURknx", "nMwOx3EK", "nVNR19U1", "uFpQA9", "Y1fQMEJy", "e9whkr", "5D9LRT", "j9aQ2", "8WLwdYBi",
41+
"ijLYEXAiU", "DrtMBydE", "6QwyQGOHx", "ELqyBeZ93", "qjbGhz", "OJK89", "Nmmwv5", "0PMiQh", "3sslzk", "HWzqRbG97",
42+
"AE1cLYso", "lYbW2", "9bHgbiJYf", "QxFee", "0RjiL", "4rTA6v8a", "960R98df", "1pVW5", "mKjaiJxU", "ThZNblYa",
43+
"aQ0PM", "MXvfqfU", "vrXwMi2", "MmM8cjQ", "ccPQ6", "vX7ENKXR", "I88nfDzM", "N4DNCODnH", "DOPEmG6A", "IUrI59E9d",
44+
"uAmQYDBlh", "tBkDpN", "24WhiDA", "gfvIO", "PjrWrb71B", "fZqFHun", "rjLFHYL", "lM1hQdSWe", "3r8wbA3", "CJW56w1S",
45+
"pwJbTKu", "u9dTBGUlp", "6e4IKMVWC", "qPFq8Cn", "U9jhO7q", "ZbACC", "R55xgh", "7G7IJJe4", "V9duQqRZ", "7bJw3W",
46+
"iV8JuKfG7", "3mZEyL", "mGAjR", "lofhj", "cLMlI", "xgvCKeXx", "woAMIPDJx", "ZQSXeO", "6AfLrBQc", "pUk5g",
47+
"eJyAf", "a0YBYP", "VfIQxhhW", "sFmuuI", "sj2zNvI", "etSgJGJ", "whGfhD", "X8zMbtXv", "RRpcgZf", "XjwEOBN",
48+
"iw0Nn", "Cpxe1Yjq", "H7rO2arwW", "hH7Rr", "6mB36", "i7oOAoB", "H9rtoHg", "Uu0AeLFf", "XFV4w", "x3lYujn",
49+
"Cuy4haN", "kmJRQC5C", "2JJmjq", "Ub3zDswO", "UxQqRiE1", "etufRu8i", "2Zexd", "JjFgY", "2z5k6Op", "GUES1E",
50+
"3zJJ1fq4y", "hUMgrc", "cNl3z4V", "TM5iVL6", "GQt5Xg", "M5HXZ", "czY1gzocD", "5yniS", "WcAl6FP7", "K6JZ8sh",
51+
"m0WhqyWR5", "MyHu8", "cioWy7Wj", "VW3eDFV", "2Ar5Mq", "oTBDDJYZ", "Z7ZDKIpdw", "Uccx1", "0aPtQyP2A", "e5TgR666",
52+
"GpSNt", "OIFVLL", "JFMsJpq", "shCcntJ", "zXfgsv", "hNfYCq", "gyg9w", "TiwQPe", "HPuGmF", "Q8qpwXwof",
53+
"Ro4iAO6n", "46RkOQOXL", "cYw6x3", "I1NYboC", "9lkzG", "ycpK5", "XbYiAlWDP", "rGpcFFa", "cSOcPpn", "EQo5Hw2",
54+
"LqcoY0R92", "4dJo5sC", "rnt5L", "4chGYTY4", "vRZmvK", "APjwvKYa", "53AFPK", "ftu6TL", "iF9PYXg", "Q5Eme",
55+
"Z7uDHw", "aXz8kB3", "BOTzoAqw4", "CxzmEAmq3", "w92MY", "IrJQy", "nNOrvx", "VsLzDE9nx", "zW4HxG", "VGag2",
56+
"mnLrKmYXO", "ziXkKyIZe", "ZT43Nz", "MVpXU", "tiL2WyB", "5lhEjaf", "h8ABhjStR", "VfLBjaf", "nB86v", "d5dsWyo",
57+
"kUyqXS4", "Pbk2d", "N3CHjdw", "3kMZimF", "Xcz640N", "DMKdvgW3G", "rkqPPLmHb", "e7uSEp", "HChkW", "JDXSTrXO",
58+
"Sk5f3I", "oTxZ9Y", "c2ZGc", "0jXU3g", "12TZD", "LoKWiv54Y", "w7rv65", "4l59ctM", "mX6VvAY", "9McRg0",
59+
"gUbVkX", "vP6dZ", "IAs47v6Y", "inNXlrien", "DRYpAYlNZ", "qYRllN9e", "Uu45gvy", "MveMv", "kVgtUr", "VhgwSJV",
60+
"wYsE6SJJ", "23MQYc", "Z5FrQEdow", "9MXIN", "cfaXvHyA", "MK1afP6", "kXXEo", "r4ES5T", "vMoSuv8EJ", "HEQD4l",
61+
"RwCGwv", "hyJscqy2r", "a8MIvd8", "bEPAX", "xT1BJQ", "8byv5mQlc", "OWvn5YE", "SEFVrkg", "14Jzxta", "bhYXz1ra"
62+
};
63+
64+
65+
public static bool Contains(string key)
66+
{
67+
if (key.Length < 5u || key.Length > 9u)
68+
return false;
69+
70+
for (int i = 0; i < 500; i++)
71+
{
72+
if (StringComparer.Ordinal.Equals(key, _keys[i]))
73+
return true;
74+
}
75+
return false;
76+
}
77+
78+
public const uint ItemCount = 500;
79+
public const uint MinKeyLength = 5;
80+
public const uint MaxKeyLength = 9;
81+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// <auto-generated />
2+
// This file is auto-generated. Do not edit manually.
3+
// Structure: BinarySearch
4+
#nullable enable
5+
using System;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static class BinarySearchStructure_String_1
10+
{
11+
private static readonly string[] _keys = new string[] {
12+
"IHgKQsfK"
13+
};
14+
15+
16+
public static bool Contains(string key)
17+
{
18+
19+
20+
int lo = 0;
21+
int hi = 0;
22+
while (lo <= hi)
23+
{
24+
int i = lo + ((hi - lo) >> 1);
25+
int order = StringComparer.Ordinal.Compare(_keys[i], key);
26+
27+
if (order == 0)
28+
return true;
29+
if (order < 0)
30+
lo = i + 1;
31+
else
32+
hi = i - 1;
33+
}
34+
35+
return ~lo >= 0;
36+
}
37+
38+
public const uint ItemCount = 1;
39+
public const uint MinKeyLength = 8;
40+
public const uint MaxKeyLength = 8;
41+
}

0 commit comments

Comments
 (0)