com.wallstop-studios.unity-helpers 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -0
- package/Docs/ILIST_SORTING_PERFORMANCE.md +92 -0
- package/{package-lock.json.meta → Docs/ILIST_SORTING_PERFORMANCE.md.meta} +1 -1
- package/Docs/INDEX.md +11 -1
- package/Docs/Images/random_generators.svg +7 -7
- package/Docs/RANDOM_PERFORMANCE.md +17 -14
- package/Docs/REFLECTION_HELPERS.md +84 -1
- package/Docs/REFLECTION_PERFORMANCE.md +169 -0
- package/Docs/REFLECTION_PERFORMANCE.md.meta +7 -0
- package/Docs/RELATIONAL_COMPONENTS.md +6 -0
- package/Docs/RELATIONAL_COMPONENT_PERFORMANCE.md +63 -0
- package/Docs/RELATIONAL_COMPONENT_PERFORMANCE.md.meta +7 -0
- package/Docs/SPATIAL_TREE_2D_PERFORMANCE.md +64 -64
- package/Docs/SPATIAL_TREE_3D_PERFORMANCE.md +64 -64
- package/Editor/Core/Helper/AnimationEventHelpers.cs +1 -1
- package/Editor/Sprites/AnimationCopier.cs +1 -1
- package/Editor/Sprites/AnimationViewerWindow.cs +4 -4
- package/Editor/Sprites/SpriteSettingsApplierAPI.cs +2 -1
- package/Editor/Sprites/TextureResizerWizard.cs +4 -3
- package/Editor/Utils/ScriptableObjectSingletonCreator.cs +3 -3
- package/README.md +33 -18
- package/Runtime/Core/Attributes/BaseRelationalComponentAttribute.cs +147 -20
- package/Runtime/Core/Attributes/ChildComponentAttribute.cs +630 -117
- package/Runtime/Core/Attributes/NotNullAttribute.cs +5 -2
- package/Runtime/Core/Attributes/ParentComponentAttribute.cs +477 -103
- package/Runtime/Core/Attributes/RelationalComponentAssigner.cs +26 -3
- package/Runtime/Core/Attributes/RelationalComponentExtensions.cs +19 -3
- package/Runtime/Core/Attributes/SiblingComponentAttribute.cs +265 -92
- package/Runtime/Core/CodeGen.meta +8 -0
- package/Runtime/Core/DataStructure/ImmutableBitSet.cs +5 -20
- package/Runtime/Core/Extension/IListExtensions.cs +720 -12
- package/Runtime/Core/Helper/Logging/UnityLogTagFormatter.cs +11 -7
- package/Runtime/Core/Helper/Objects.cs +1 -1
- package/Runtime/Core/Helper/ReflectionHelpers.Factory.cs +5142 -0
- package/Runtime/Core/Helper/ReflectionHelpers.Factory.cs.meta +11 -0
- package/Runtime/Core/Helper/ReflectionHelpers.cs +1812 -1518
- package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +2 -3
- package/Runtime/Core/Math/Line2D.cs +2 -4
- package/Runtime/Core/Math/Line3D.cs +2 -4
- package/Runtime/Core/Random/AbstractRandom.cs +52 -5
- package/Runtime/Core/Random/DotNetRandom.cs +3 -3
- package/Runtime/Core/Random/FlurryBurstRandom.cs +279 -0
- package/Runtime/Core/Random/FlurryBurstRandom.cs.meta +3 -0
- package/Runtime/Core/Random/IllusionFlow.cs +3 -3
- package/Runtime/Core/Random/LinearCongruentialGenerator.cs +3 -3
- package/Runtime/Core/Random/PcgRandom.cs +6 -6
- package/Runtime/Core/Random/PhotonSpinRandom.cs +387 -0
- package/Runtime/Core/Random/PhotonSpinRandom.cs.meta +3 -0
- package/Runtime/Core/Random/RomuDuo.cs +3 -3
- package/Runtime/Core/Random/SplitMix64.cs +3 -3
- package/Runtime/Core/Random/SquirrelRandom.cs +6 -4
- package/Runtime/Core/Random/StormDropRandom.cs +271 -0
- package/Runtime/Core/Random/StormDropRandom.cs.meta +3 -0
- package/Runtime/Core/Random/UnityRandom.cs +3 -3
- package/Runtime/Core/Random/WyRandom.cs +6 -4
- package/Runtime/Core/Random/XorShiftRandom.cs +3 -3
- package/Runtime/Core/Random/XoroShiroRandom.cs +3 -3
- package/Runtime/Tags/AttributeMetadataCache.cs +316 -9
- package/Runtime/Tags/CosmeticEffectData.cs +1 -1
- package/Runtime/Visuals/UIToolkit/MultiFileSelectorElement.cs +3 -3
- package/Tests/Editor/Helper/HelpersTests.cs +2 -2
- package/Tests/Editor/Helper/ReflectionHelpersTypedEditorTests.cs +87 -0
- package/Tests/Editor/Helper/ReflectionHelpersTypedEditorTests.cs.meta +11 -0
- package/Tests/Editor/Helper/SpriteHelpersTests.cs +1 -1
- package/Tests/Editor/PrefabCheckerReportTests.cs +3 -3
- package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs +18 -12
- package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs +8 -7
- package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs +2 -1
- package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs +6 -5
- package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs +2 -1
- package/Tests/Editor/Sprites/SpriteCropperTests.cs +7 -6
- package/Tests/Editor/Sprites/SpritePivotAdjusterAdditionalTests.cs +2 -1
- package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs +4 -3
- package/Tests/Editor/Sprites/TextureResizerWizardTests.cs +10 -9
- package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs +2 -1
- package/Tests/Editor/Tags/AttributeMetadataCacheTests.cs +192 -0
- package/Tests/Editor/Tags/AttributeMetadataCacheTests.cs.meta +11 -0
- package/Tests/Editor/Tags.meta +8 -0
- package/Tests/Runtime/Extensions/IListExtensionTests.cs +187 -1
- package/Tests/Runtime/Helper/ObjectsTests.cs +4 -4
- package/Tests/Runtime/Helper/ReflectionHelperCapabilityMatrixTests.cs +2923 -0
- package/Tests/Runtime/Helper/ReflectionHelperCapabilityMatrixTests.cs.meta +11 -0
- package/Tests/Runtime/Helper/ReflectionHelperTests.cs +660 -0
- package/Tests/Runtime/Integrations/Reflex/RelationalComponentsReflexTests.cs +2 -2
- package/Tests/Runtime/Performance/IListSortingPerformanceTests.cs +346 -0
- package/Tests/Runtime/Performance/IListSortingPerformanceTests.cs.meta +11 -0
- package/Tests/Runtime/Performance/RandomPerformanceTests.cs +3 -0
- package/Tests/Runtime/Performance/ReflectionPerformanceTests.cs +1238 -0
- package/Tests/Runtime/Performance/ReflectionPerformanceTests.cs.meta +11 -0
- package/Tests/Runtime/Performance/RelationalComponentBenchmarkTests.cs +832 -0
- package/Tests/Runtime/Performance/RelationalComponentBenchmarkTests.cs.meta +11 -0
- package/Tests/Runtime/Random/FlurryBurstRandomTests.cs +12 -0
- package/Tests/Runtime/Random/FlurryBurstRandomTests.cs.meta +3 -0
- package/Tests/Runtime/Random/PhotonSpinRandomTests.cs +12 -0
- package/Tests/Runtime/Random/PhotonSpinRandomTests.cs.meta +3 -0
- package/Tests/Runtime/Random/RandomProtoSerializationTests.cs +14 -0
- package/Tests/Runtime/Random/RandomTestBase.cs +39 -4
- package/Tests/Runtime/Random/StormDropRandomTests.cs +12 -0
- package/Tests/Runtime/Random/StormDropRandomTests.cs.meta +3 -0
- package/Tests/Runtime/Serialization/ProtoInterfaceResolutionEdgeTests.cs +2 -2
- package/Tests/Runtime/Serialization/ProtoRootRegistrationTests.cs +1 -1
- package/Tests/Runtime/Serialization/ProtoSerializeBehaviorTests.cs +1 -1
- package/Tests/Runtime/Tags/PeriodicEffectDefinitionSerializationTests.cs +2 -2
- package/package.json +1 -1
- package/Tests/Runtime/Performance/RelationComponentPerformanceTests.cs +0 -60
- package/Tests/Runtime/Performance/RelationComponentPerformanceTests.cs.meta +0 -3
|
@@ -321,7 +321,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Integrations.Reflex
|
|
|
321
321
|
GameObject root = Track(new GameObject("ReflexComponentPrefab"));
|
|
322
322
|
ReflexRelationalTester tester = root.AddComponent<ReflexRelationalTester>();
|
|
323
323
|
|
|
324
|
-
GameObject child = new
|
|
324
|
+
GameObject child = new("ReflexComponentPrefabChild");
|
|
325
325
|
child.AddComponent<CapsuleCollider>();
|
|
326
326
|
child.transform.SetParent(root.transform, false);
|
|
327
327
|
|
|
@@ -334,7 +334,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Integrations.Reflex
|
|
|
334
334
|
GameObject root = Track(new GameObject("ReflexGameObjectPrefab"));
|
|
335
335
|
root.AddComponent<ReflexRelationalTester>();
|
|
336
336
|
|
|
337
|
-
GameObject child = new
|
|
337
|
+
GameObject child = new("ReflexGameObjectPrefabChild");
|
|
338
338
|
child.AddComponent<CapsuleCollider>();
|
|
339
339
|
child.transform.SetParent(root.transform, false);
|
|
340
340
|
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Tests.Performance
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using System.Diagnostics;
|
|
6
|
+
using System.Globalization;
|
|
7
|
+
using System.Text;
|
|
8
|
+
using NUnit.Framework;
|
|
9
|
+
using UnityEngine;
|
|
10
|
+
using WallstopStudios.UnityHelpers.Core.Extension;
|
|
11
|
+
using WallstopStudios.UnityHelpers.Core.Random;
|
|
12
|
+
|
|
13
|
+
public sealed class IListSortingPerformanceTests
|
|
14
|
+
{
|
|
15
|
+
private const string DocumentPath = "Docs/ILIST_SORTING_PERFORMANCE.md";
|
|
16
|
+
private const string SectionPrefix = "ILIST_SORT_";
|
|
17
|
+
private const int NearlySortedSwapPercentage = 50;
|
|
18
|
+
|
|
19
|
+
private static readonly DatasetSizeSpec[] DatasetSizeSpecs =
|
|
20
|
+
{
|
|
21
|
+
new DatasetSizeSpec("100", 100),
|
|
22
|
+
new DatasetSizeSpec("1,000", 1_000),
|
|
23
|
+
new DatasetSizeSpec("10,000", 10_000),
|
|
24
|
+
new DatasetSizeSpec("100,000", 100_000),
|
|
25
|
+
new DatasetSizeSpec("1,000,000", 1_000_000),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
private static readonly DatasetState[] DatasetStates =
|
|
29
|
+
{
|
|
30
|
+
new DatasetState("Sorted", BuildSortedData),
|
|
31
|
+
new DatasetState("Nearly Sorted (2% swaps)", BuildNearlySortedData),
|
|
32
|
+
new DatasetState("Shuffled (deterministic)", BuildShuffledData),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
private static readonly SortImplementation[] SortImplementations =
|
|
36
|
+
{
|
|
37
|
+
new SortImplementation("Ghost", SortAlgorithm.Ghost, false, int.MaxValue),
|
|
38
|
+
new SortImplementation("Meteor", SortAlgorithm.Meteor, false, int.MaxValue),
|
|
39
|
+
new SortImplementation(
|
|
40
|
+
"Pattern-Defeating QuickSort",
|
|
41
|
+
SortAlgorithm.PatternDefeatingQuickSort,
|
|
42
|
+
false,
|
|
43
|
+
int.MaxValue
|
|
44
|
+
),
|
|
45
|
+
new SortImplementation("Grail", SortAlgorithm.Grail, true, int.MaxValue),
|
|
46
|
+
new SortImplementation("Power", SortAlgorithm.Power, true, int.MaxValue),
|
|
47
|
+
new SortImplementation("Insertion", SortAlgorithm.Insertion, true, 10_000),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
[Test]
|
|
51
|
+
[Timeout(0)]
|
|
52
|
+
public void Benchmark()
|
|
53
|
+
{
|
|
54
|
+
string operatingSystemToken = GetOperatingSystemToken();
|
|
55
|
+
string sectionName = SectionPrefix + operatingSystemToken;
|
|
56
|
+
|
|
57
|
+
List<string> readmeLines = new List<string>
|
|
58
|
+
{
|
|
59
|
+
string.Format(
|
|
60
|
+
CultureInfo.InvariantCulture,
|
|
61
|
+
"_Last updated {0:yyyy-MM-dd HH:mm} UTC on {1}_",
|
|
62
|
+
DateTime.UtcNow,
|
|
63
|
+
SystemInfo.operatingSystem
|
|
64
|
+
),
|
|
65
|
+
string.Empty,
|
|
66
|
+
"Times are single-pass measurements in milliseconds (lower is better). `n/a` indicates the algorithm was skipped for the dataset size.",
|
|
67
|
+
string.Empty,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
IComparer<int> comparer = Comparer<int>.Default;
|
|
71
|
+
string headerLine = BuildHeaderLine();
|
|
72
|
+
string dividerLine = BuildDividerLine();
|
|
73
|
+
|
|
74
|
+
foreach (DatasetState datasetState in DatasetStates)
|
|
75
|
+
{
|
|
76
|
+
UnityEngine.Debug.Log($"IList Sorting Benchmarks - {datasetState.Label}");
|
|
77
|
+
UnityEngine.Debug.Log(headerLine);
|
|
78
|
+
UnityEngine.Debug.Log(dividerLine);
|
|
79
|
+
|
|
80
|
+
readmeLines.Add($"### {datasetState.Label}");
|
|
81
|
+
readmeLines.Add(headerLine);
|
|
82
|
+
readmeLines.Add(dividerLine);
|
|
83
|
+
|
|
84
|
+
foreach (DatasetSizeSpec sizeSpec in DatasetSizeSpecs)
|
|
85
|
+
{
|
|
86
|
+
int[] baseData = datasetState.CreateData(sizeSpec.Count);
|
|
87
|
+
string rowLine = BuildRowLine(sizeSpec.Label, baseData, comparer);
|
|
88
|
+
UnityEngine.Debug.Log(rowLine);
|
|
89
|
+
readmeLines.Add(rowLine);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
readmeLines.Add(string.Empty);
|
|
93
|
+
UnityEngine.Debug.Log(string.Empty);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
BenchmarkReadmeUpdater.UpdateSection(sectionName, readmeLines, DocumentPath);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private static string BuildHeaderLine()
|
|
100
|
+
{
|
|
101
|
+
StringBuilder headerBuilder = new StringBuilder();
|
|
102
|
+
headerBuilder.Append("| List Size |");
|
|
103
|
+
foreach (SortImplementation implementation in SortImplementations)
|
|
104
|
+
{
|
|
105
|
+
headerBuilder.Append(' ');
|
|
106
|
+
headerBuilder.Append(implementation.Label);
|
|
107
|
+
headerBuilder.Append(" |");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return headerBuilder.ToString();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private static string BuildDividerLine()
|
|
114
|
+
{
|
|
115
|
+
StringBuilder dividerBuilder = new StringBuilder();
|
|
116
|
+
dividerBuilder.Append("| --- |");
|
|
117
|
+
foreach (SortImplementation implementation in SortImplementations)
|
|
118
|
+
{
|
|
119
|
+
dividerBuilder.Append(" --- |");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return dividerBuilder.ToString();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private static string BuildRowLine(
|
|
126
|
+
string sizeLabel,
|
|
127
|
+
int[] baseData,
|
|
128
|
+
IComparer<int> comparer
|
|
129
|
+
)
|
|
130
|
+
{
|
|
131
|
+
StringBuilder rowBuilder = new StringBuilder();
|
|
132
|
+
rowBuilder.Append("| ");
|
|
133
|
+
rowBuilder.Append(sizeLabel);
|
|
134
|
+
rowBuilder.Append(" |");
|
|
135
|
+
|
|
136
|
+
foreach (SortImplementation implementation in SortImplementations)
|
|
137
|
+
{
|
|
138
|
+
string result = BenchmarkImplementation(implementation, baseData, comparer);
|
|
139
|
+
rowBuilder.Append(' ');
|
|
140
|
+
rowBuilder.Append(result);
|
|
141
|
+
rowBuilder.Append(" |");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return rowBuilder.ToString();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private static string BenchmarkImplementation(
|
|
148
|
+
SortImplementation implementation,
|
|
149
|
+
int[] baseData,
|
|
150
|
+
IComparer<int> comparer
|
|
151
|
+
)
|
|
152
|
+
{
|
|
153
|
+
if (baseData.Length > implementation.MaxSupportedCount)
|
|
154
|
+
{
|
|
155
|
+
return "n/a";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
int[] workingData = new int[baseData.Length];
|
|
159
|
+
Array.Copy(baseData, workingData, baseData.Length);
|
|
160
|
+
|
|
161
|
+
IList<int> workingList = workingData;
|
|
162
|
+
Stopwatch stopwatch = Stopwatch.StartNew();
|
|
163
|
+
|
|
164
|
+
try
|
|
165
|
+
{
|
|
166
|
+
implementation.Execute(workingList, comparer);
|
|
167
|
+
}
|
|
168
|
+
catch (Exception exception)
|
|
169
|
+
{
|
|
170
|
+
UnityEngine.Debug.LogError(
|
|
171
|
+
$"Sorting benchmark failed for {implementation.Label}: {exception.Message}"
|
|
172
|
+
);
|
|
173
|
+
return "error";
|
|
174
|
+
}
|
|
175
|
+
finally
|
|
176
|
+
{
|
|
177
|
+
stopwatch.Stop();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
double milliseconds = stopwatch.Elapsed.TotalMilliseconds;
|
|
181
|
+
return FormatDuration(milliseconds);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private static string FormatDuration(double milliseconds)
|
|
185
|
+
{
|
|
186
|
+
if (milliseconds >= 1000d)
|
|
187
|
+
{
|
|
188
|
+
double seconds = milliseconds / 1000d;
|
|
189
|
+
return string.Format(CultureInfo.InvariantCulture, "{0:0.00} s", seconds);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (milliseconds >= 100d)
|
|
193
|
+
{
|
|
194
|
+
return string.Format(CultureInfo.InvariantCulture, "{0:0} ms", milliseconds);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (milliseconds >= 10d)
|
|
198
|
+
{
|
|
199
|
+
return string.Format(CultureInfo.InvariantCulture, "{0:0.0} ms", milliseconds);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (milliseconds >= 1d)
|
|
203
|
+
{
|
|
204
|
+
return string.Format(CultureInfo.InvariantCulture, "{0:0.00} ms", milliseconds);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return string.Format(CultureInfo.InvariantCulture, "{0:0.000} ms", milliseconds);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private static int[] BuildSortedData(int count)
|
|
211
|
+
{
|
|
212
|
+
int[] data = new int[count];
|
|
213
|
+
for (int i = 0; i < count; ++i)
|
|
214
|
+
{
|
|
215
|
+
data[i] = i;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return data;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
private static int[] BuildNearlySortedData(int count)
|
|
222
|
+
{
|
|
223
|
+
int[] data = BuildSortedData(count);
|
|
224
|
+
if (count <= 1)
|
|
225
|
+
{
|
|
226
|
+
return data;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
int swaps = Math.Max(1, count / NearlySortedSwapPercentage);
|
|
230
|
+
IRandom random = new PcgRandom(unchecked(count * 37));
|
|
231
|
+
|
|
232
|
+
for (int i = 0; i < swaps; ++i)
|
|
233
|
+
{
|
|
234
|
+
int index = random.Next(0, count - 1);
|
|
235
|
+
int neighbor = Math.Min(count - 1, index + 1);
|
|
236
|
+
int temp = data[index];
|
|
237
|
+
data[index] = data[neighbor];
|
|
238
|
+
data[neighbor] = temp;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return data;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private static int[] BuildShuffledData(int count)
|
|
245
|
+
{
|
|
246
|
+
int[] data = BuildSortedData(count);
|
|
247
|
+
if (count <= 1)
|
|
248
|
+
{
|
|
249
|
+
return data;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
IRandom random = new PcgRandom(unchecked(count * 7919));
|
|
253
|
+
|
|
254
|
+
for (int i = count - 1; i > 0; --i)
|
|
255
|
+
{
|
|
256
|
+
int swapIndex = random.Next(0, i + 1);
|
|
257
|
+
int temp = data[i];
|
|
258
|
+
data[i] = data[swapIndex];
|
|
259
|
+
data[swapIndex] = temp;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return data;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private static string GetOperatingSystemToken()
|
|
266
|
+
{
|
|
267
|
+
RuntimePlatform platform = Application.platform;
|
|
268
|
+
switch (platform)
|
|
269
|
+
{
|
|
270
|
+
case RuntimePlatform.WindowsEditor:
|
|
271
|
+
case RuntimePlatform.WindowsPlayer:
|
|
272
|
+
case RuntimePlatform.WindowsServer:
|
|
273
|
+
return "WINDOWS";
|
|
274
|
+
case RuntimePlatform.OSXEditor:
|
|
275
|
+
case RuntimePlatform.OSXPlayer:
|
|
276
|
+
return "MACOS";
|
|
277
|
+
case RuntimePlatform.LinuxEditor:
|
|
278
|
+
case RuntimePlatform.LinuxPlayer:
|
|
279
|
+
case RuntimePlatform.LinuxServer:
|
|
280
|
+
return "LINUX";
|
|
281
|
+
default:
|
|
282
|
+
return "OTHER";
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
private readonly struct DatasetSizeSpec
|
|
287
|
+
{
|
|
288
|
+
public DatasetSizeSpec(string label, int count)
|
|
289
|
+
{
|
|
290
|
+
Label = label;
|
|
291
|
+
Count = count;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
public string Label { get; }
|
|
295
|
+
|
|
296
|
+
public int Count { get; }
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
private readonly struct DatasetState
|
|
300
|
+
{
|
|
301
|
+
private readonly Func<int, int[]> generator;
|
|
302
|
+
|
|
303
|
+
public DatasetState(string label, Func<int, int[]> generator)
|
|
304
|
+
{
|
|
305
|
+
Label = label;
|
|
306
|
+
this.generator = generator;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
public string Label { get; }
|
|
310
|
+
|
|
311
|
+
public int[] CreateData(int count)
|
|
312
|
+
{
|
|
313
|
+
return generator(count);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
private readonly struct SortImplementation
|
|
318
|
+
{
|
|
319
|
+
public SortImplementation(
|
|
320
|
+
string label,
|
|
321
|
+
SortAlgorithm algorithm,
|
|
322
|
+
bool isStable,
|
|
323
|
+
int maxSupportedCount
|
|
324
|
+
)
|
|
325
|
+
{
|
|
326
|
+
Label = label;
|
|
327
|
+
Algorithm = algorithm;
|
|
328
|
+
IsStable = isStable;
|
|
329
|
+
MaxSupportedCount = maxSupportedCount;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
public string Label { get; }
|
|
333
|
+
|
|
334
|
+
public SortAlgorithm Algorithm { get; }
|
|
335
|
+
|
|
336
|
+
public bool IsStable { get; }
|
|
337
|
+
|
|
338
|
+
public int MaxSupportedCount { get; }
|
|
339
|
+
|
|
340
|
+
public void Execute(IList<int> list, IComparer<int> comparer)
|
|
341
|
+
{
|
|
342
|
+
list.Sort(comparer, Algorithm);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
@@ -31,12 +31,15 @@ namespace WallstopStudios.UnityHelpers.Tests.Performance
|
|
|
31
31
|
LogRow(RunTest(new PcgRandom(), timeout));
|
|
32
32
|
LogRow(RunTest(new RomuDuo(), timeout));
|
|
33
33
|
LogRow(RunTest(new SplitMix64(), timeout));
|
|
34
|
+
LogRow(RunTest(new FlurryBurstRandom(), timeout));
|
|
34
35
|
LogRow(RunTest(new SquirrelRandom(), timeout));
|
|
35
36
|
LogRow(RunTest(new SystemRandom(), timeout));
|
|
36
37
|
LogRow(RunTest(new UnityRandom(), timeout));
|
|
37
38
|
LogRow(RunTest(new WyRandom(), timeout));
|
|
38
39
|
LogRow(RunTest(new XorShiftRandom(), timeout));
|
|
39
40
|
LogRow(RunTest(new XoroShiroRandom(), timeout));
|
|
41
|
+
LogRow(RunTest(new PhotonSpinRandom(), timeout));
|
|
42
|
+
LogRow(RunTest(new StormDropRandom(), timeout));
|
|
40
43
|
|
|
41
44
|
BenchmarkReadmeUpdater.UpdateSection(
|
|
42
45
|
"RANDOM_BENCHMARKS",
|