com.wallstop-studios.unity-helpers 2.1.0 → 2.1.1
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/Docs/ILIST_SORTING_PERFORMANCE.md +92 -0
- package/Docs/ILIST_SORTING_PERFORMANCE.md.meta +7 -0
- package/Docs/INDEX.md +10 -1
- package/Docs/Images/random_generators.svg +7 -7
- package/Docs/RANDOM_PERFORMANCE.md +17 -14
- 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/README.md +25 -15
- package/Runtime/Core/Extension/IListExtensions.cs +720 -12
- package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +2 -3
- package/Runtime/Core/Random/AbstractRandom.cs +52 -5
- package/Runtime/Core/Random/DotNetRandom.cs +3 -3
- package/Runtime/Core/Random/FlurryBurstRandom.cs +285 -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 +312 -3
- 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 +3 -3
- 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/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
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# IList Sorting Performance Benchmarks
|
|
2
|
+
|
|
3
|
+
Unity Helpers ships several custom sorting algorithms for `IList<T>` that cover different trade-offs between adaptability, allocation patterns, and stability. This page gathers context and benchmark snapshots so you can choose the right algorithm for your workload and compare results across operating systems.
|
|
4
|
+
|
|
5
|
+
## Algorithm Cheatsheet
|
|
6
|
+
|
|
7
|
+
| Algorithm | Stable? | Best For | Reference |
|
|
8
|
+
| --------------------------- | ------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
9
|
+
| Ghost Sort | No | Mixed workloads that benefit from adaptive gap sorting and few allocations | Upstream project by Will Stafford Parsons (public repository currently offline) |
|
|
10
|
+
| Meteor Sort | No | Almost-sorted data where gap shrinking beats plain insertion sort | [meteorsort by Wiley Looper](https://github.com/wileylooper/meteorsort) |
|
|
11
|
+
| Pattern-Defeating QuickSort | No | General-purpose quicksort with protections against worst-case inputs | [pdqsort by Orson Peters](https://github.com/orlp/pdqsort) |
|
|
12
|
+
| Grail Sort | Yes | Large datasets where stability + low allocations matter | [GrailSort](https://github.com/Mrrl/GrailSort) |
|
|
13
|
+
| Power Sort | Yes | Partially ordered data that benefits from adaptive run detection | [PowerSort (Munro & Wild)](https://arxiv.org/abs/1805.04154) |
|
|
14
|
+
| Insertion Sort | Yes | Tiny or nearly sorted collections where O(n²) is acceptable | [Wikipedia - Insertion sort](https://en.wikipedia.org/wiki/Insertion_sort) |
|
|
15
|
+
|
|
16
|
+
> **What does “stable” mean?** Stable sorting algorithms preserve the relative order of elements that compare as equal. This matters when items carry secondary keys (e.g., sorting people by last name but keeping first-name order deterministic). Unstable algorithms can reshuffle equal entries, which is usually fine for numeric keys but can break deterministic pipelines.
|
|
17
|
+
>
|
|
18
|
+
> **Heads up:** The original Ghost Sort repository was formerly hosted on GitHub under `wstaffordp/ghostsort`, but it currently returns 404. The Unity Helpers implementation remains based on that source; we will relink if/when an official mirror returns.
|
|
19
|
+
|
|
20
|
+
## Dataset Scenarios
|
|
21
|
+
|
|
22
|
+
- **Sorted** – ascending integers, verifying best-case behavior.
|
|
23
|
+
- **Nearly Sorted (2% swaps)** – deterministic neighbor swaps introduce light disorder to expose adaptive optimizations.
|
|
24
|
+
- **Shuffled (deterministic)** – Fisher–Yates shuffle using a fixed seed for reproducibility across runs and machines.
|
|
25
|
+
|
|
26
|
+
Each benchmark sorts a fresh copy of the dataset once and reports wall-clock duration. Insertion sort is skipped for lists larger than 10,000 elements because O(n²) quickly becomes impractical; the table shows `n/a` for those entries.
|
|
27
|
+
|
|
28
|
+
Run the `IListSortingPerformanceTests.Benchmark` test inside Unity’s Test Runner to refresh the tables below. Results automatically land in the section that matches the current operating system.
|
|
29
|
+
|
|
30
|
+
## Windows (Editor/Player)
|
|
31
|
+
|
|
32
|
+
<!-- ILIST_SORT_WINDOWS_START -->
|
|
33
|
+
|
|
34
|
+
_Last updated 2025-10-26 18:00 UTC on Windows 11 (10.0.26200) 64bit_
|
|
35
|
+
|
|
36
|
+
Times are single-pass measurements in milliseconds (lower is better). `n/a` indicates the algorithm was skipped for the dataset size.
|
|
37
|
+
|
|
38
|
+
### Sorted
|
|
39
|
+
|
|
40
|
+
| List Size | Ghost | Meteor | Pattern-Defeating QuickSort | Grail | Power | Insertion |
|
|
41
|
+
| --------- | -------- | -------- | --------------------------- | -------- | -------- | --------- |
|
|
42
|
+
| 100 | 0.373 ms | 0.072 ms | 0.422 ms | 2.04 ms | 0.907 ms | 0.071 ms |
|
|
43
|
+
| 1,000 | 0.021 ms | 0.025 ms | 0.007 ms | 0.040 ms | 0.005 ms | 0.005 ms |
|
|
44
|
+
| 10,000 | 0.288 ms | 0.368 ms | 0.067 ms | 0.555 ms | 0.041 ms | 0.054 ms |
|
|
45
|
+
| 100,000 | 3.35 ms | 4.81 ms | 0.703 ms | 10.7 ms | 0.424 ms | n/a |
|
|
46
|
+
| 1,000,000 | 37.0 ms | 57.1 ms | 6.70 ms | 11.4 ms | 4.08 ms | n/a |
|
|
47
|
+
|
|
48
|
+
### Nearly Sorted (2% swaps)
|
|
49
|
+
|
|
50
|
+
| List Size | Ghost | Meteor | Pattern-Defeating QuickSort | Grail | Power | Insertion |
|
|
51
|
+
| --------- | -------- | -------- | --------------------------- | -------- | -------- | --------- |
|
|
52
|
+
| 100 | 0.002 ms | 0.002 ms | 0.007 ms | 0.145 ms | 0.053 ms | 0.001 ms |
|
|
53
|
+
| 1,000 | 0.021 ms | 0.025 ms | 0.032 ms | 0.009 ms | 0.020 ms | 0.006 ms |
|
|
54
|
+
| 10,000 | 0.279 ms | 0.355 ms | 0.383 ms | 0.072 ms | 0.223 ms | 0.057 ms |
|
|
55
|
+
| 100,000 | 3.17 ms | 4.64 ms | 4.61 ms | 0.689 ms | 3.47 ms | n/a |
|
|
56
|
+
| 1,000,000 | 37.3 ms | 57.3 ms | 53.9 ms | 7.45 ms | 44.8 ms | n/a |
|
|
57
|
+
|
|
58
|
+
### Shuffled (deterministic)
|
|
59
|
+
|
|
60
|
+
| List Size | Ghost | Meteor | Pattern-Defeating QuickSort | Grail | Power | Insertion |
|
|
61
|
+
| --------- | -------- | -------- | --------------------------- | -------- | -------- | --------- |
|
|
62
|
+
| 100 | 0.009 ms | 0.007 ms | 0.007 ms | 0.011 ms | 0.010 ms | 0.015 ms |
|
|
63
|
+
| 1,000 | 0.143 ms | 0.123 ms | 0.089 ms | 0.106 ms | 0.111 ms | 1.34 ms |
|
|
64
|
+
| 10,000 | 1.97 ms | 1.76 ms | 1.16 ms | 1.38 ms | 1.41 ms | 131 ms |
|
|
65
|
+
| 100,000 | 28.3 ms | 23.5 ms | 14.4 ms | 17.3 ms | 17.5 ms | n/a |
|
|
66
|
+
| 1,000,000 | 395 ms | 296 ms | 171 ms | 207 ms | 212 ms | n/a |
|
|
67
|
+
|
|
68
|
+
<!-- ILIST_SORT_WINDOWS_END -->
|
|
69
|
+
|
|
70
|
+
## macOS
|
|
71
|
+
|
|
72
|
+
<!-- ILIST_SORT_MACOS_START -->
|
|
73
|
+
|
|
74
|
+
Pending — run the IList sorting benchmark suite on macOS to capture results.
|
|
75
|
+
|
|
76
|
+
<!-- ILIST_SORT_MACOS_END -->
|
|
77
|
+
|
|
78
|
+
## Linux
|
|
79
|
+
|
|
80
|
+
<!-- ILIST_SORT_LINUX_START -->
|
|
81
|
+
|
|
82
|
+
Pending — run the IList sorting benchmark suite on Linux to capture results.
|
|
83
|
+
|
|
84
|
+
<!-- ILIST_SORT_LINUX_END -->
|
|
85
|
+
|
|
86
|
+
## Other Platforms
|
|
87
|
+
|
|
88
|
+
<!-- ILIST_SORT_OTHER_START -->
|
|
89
|
+
|
|
90
|
+
Pending — run the IList sorting benchmark suite on the target platform to capture results.
|
|
91
|
+
|
|
92
|
+
<!-- ILIST_SORT_OTHER_END -->
|
package/Docs/INDEX.md
CHANGED
|
@@ -139,6 +139,9 @@ Alphabetical index of all Unity Helpers features with quick links to documentati
|
|
|
139
139
|
**Fit Texture Size** - Auto-adjust texture max size to source dimensions
|
|
140
140
|
→ [Editor Tools Guide](EDITOR_TOOLS_GUIDE.md#fit-texture-size)
|
|
141
141
|
|
|
142
|
+
**FlurryBurstRandom** - Six-word ARX generator (FlurryBurst32 port)
|
|
143
|
+
→ [README - Random Generators](../README.md#random-number-generators) | [Random Performance](RANDOM_PERFORMANCE.md)
|
|
144
|
+
|
|
142
145
|
---
|
|
143
146
|
|
|
144
147
|
## G
|
|
@@ -262,6 +265,9 @@ Alphabetical index of all Unity Helpers features with quick links to documentati
|
|
|
262
265
|
**PcgRandom** - High-quality PCG random generator
|
|
263
266
|
→ [README - Random Generators](../README.md#random-number-generators) | [Random Performance](RANDOM_PERFORMANCE.md)
|
|
264
267
|
|
|
268
|
+
**PhotonSpinRandom** - SHISHUA-inspired bulk generator
|
|
269
|
+
→ [README - Random Generators](../README.md#random-number-generators) | [Random Performance](RANDOM_PERFORMANCE.md)
|
|
270
|
+
|
|
265
271
|
**Point-in-Polygon** - 2D/3D containment tests
|
|
266
272
|
→ [Math & Extensions](MATH_AND_EXTENSIONS.md#geometry)
|
|
267
273
|
|
|
@@ -306,7 +312,7 @@ Alphabetical index of all Unity Helpers features with quick links to documentati
|
|
|
306
312
|
**Random Extensions** - Random vectors, colors, weighted selection, subset sampling
|
|
307
313
|
→ [Math & Extensions](MATH_AND_EXTENSIONS.md#random-generators)
|
|
308
314
|
|
|
309
|
-
**Random Generators** -
|
|
315
|
+
**Random Generators** - 15 high-performance PRNG implementations
|
|
310
316
|
→ [README - Random Generators](../README.md#random-number-generators) | [Random Performance](RANDOM_PERFORMANCE.md)
|
|
311
317
|
|
|
312
318
|
**Range<T>** - Inclusive/exclusive range helper
|
|
@@ -352,6 +358,9 @@ Alphabetical index of all Unity Helpers features with quick links to documentati
|
|
|
352
358
|
**Singletons** - Runtime and ScriptableObject singleton patterns
|
|
353
359
|
→ [Singletons Guide](SINGLETONS.md) | [README](../README.md#singleton-utilities-odin-compatible)
|
|
354
360
|
|
|
361
|
+
**StormDropRandom** - Large-buffer ARX generator
|
|
362
|
+
→ [README - Random Generators](../README.md#random-number-generators) | [Random Performance](RANDOM_PERFORMANCE.md)
|
|
363
|
+
|
|
355
364
|
**Sparse Set** - O(1) membership with dense iteration
|
|
356
365
|
→ [Data Structures](DATA_STRUCTURES.md#sparse-set) | [README](../README.md#data-structures)
|
|
357
366
|
|
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
<!-- pip patterns 1,2,5,6 -->
|
|
83
83
|
<circle cx="392" cy="267" r="2"/>
|
|
84
84
|
<circle cx="420" cy="262" r="2"/>
|
|
85
|
-
<circle cx="424" cy="
|
|
85
|
+
<circle cx="424" cy="272" r="2"/>
|
|
86
86
|
<circle cx="450" cy="260" r="2"/>
|
|
87
|
-
<circle cx="
|
|
88
|
-
<circle cx="
|
|
89
|
-
<circle cx="
|
|
90
|
-
<circle cx="
|
|
91
|
-
<circle cx="
|
|
92
|
-
<circle cx="
|
|
87
|
+
<circle cx="453" cy="266" r="2"/>
|
|
88
|
+
<circle cx="456" cy="272" r="2"/>
|
|
89
|
+
<circle cx="478" cy="262" r="2"/>
|
|
90
|
+
<circle cx="488" cy="262" r="2"/>
|
|
91
|
+
<circle cx="478" cy="272" r="2"/>
|
|
92
|
+
<circle cx="488" cy="272" r="2"/>
|
|
93
93
|
</g>
|
|
94
94
|
<g font-family="Verdana,Arial,sans-serif" font-size="10" fill="#9fb3c8">
|
|
95
95
|
<text x="390" y="315">discrete outcomes</text>
|
|
@@ -81,18 +81,21 @@ This document contains performance benchmarks for the various random number gene
|
|
|
81
81
|
|
|
82
82
|
| Random | NextBool | Next | NextUInt | NextFloat | NextDouble | NextUint - Range | NextInt - Range |
|
|
83
83
|
| --------------------------- | ----------- | ----------- | ------------- | ----------- | ----------- | ---------------- | --------------- |
|
|
84
|
-
| DotNetRandom |
|
|
85
|
-
| LinearCongruentialGenerator |
|
|
86
|
-
| IllusionFlow |
|
|
87
|
-
| PcgRandom |
|
|
88
|
-
| RomuDuo |
|
|
89
|
-
| SplitMix64 |
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
84
|
+
| DotNetRandom | 535,000,000 | 54,400,000 | 56,700,000 | 45,200,000 | 28,200,000 | 52,200,000 | 51,800,000 |
|
|
85
|
+
| LinearCongruentialGenerator | 798,300,000 | 823,200,000 | 1,329,100,000 | 179,900,000 | 402,000,000 | 577,800,000 | 493,300,000 |
|
|
86
|
+
| IllusionFlow | 778,000,000 | 662,100,000 | 895,100,000 | 178,000,000 | 331,100,000 | 444,000,000 | 384,900,000 |
|
|
87
|
+
| PcgRandom | 762,500,000 | 668,400,000 | 892,700,000 | 179,700,000 | 345,200,000 | 450,000,000 | 400,200,000 |
|
|
88
|
+
| RomuDuo | 758,600,000 | 579,300,000 | 767,300,000 | 167,200,000 | 255,900,000 | 446,500,000 | 397,400,000 |
|
|
89
|
+
| SplitMix64 | 800,900,000 | 670,400,000 | 943,700,000 | 179,000,000 | 346,600,000 | 473,300,000 | 432,800,000 |
|
|
90
|
+
| FlurryBurstRandom | 762,800,000 | 603,800,000 | 863,700,000 | 183,000,000 | 305,200,000 | 456,400,000 | 412,400,000 |
|
|
91
|
+
| SquirrelRandom | 759,700,000 | 393,600,000 | 413,500,000 | 172,300,000 | 187,800,000 | 329,600,000 | 307,100,000 |
|
|
92
|
+
| SystemRandom | 138,400,000 | 144,300,000 | 63,200,000 | 127,600,000 | 135,800,000 | 59,600,000 | 60,400,000 |
|
|
93
|
+
| UnityRandom | 655,300,000 | 85,000,000 | 87,800,000 | 62,200,000 | 41,500,000 | 81,500,000 | 82,400,000 |
|
|
94
|
+
| WyRandom | 758,600,000 | 390,600,000 | 457,100,000 | 166,800,000 | 191,100,000 | 293,600,000 | 274,700,000 |
|
|
95
|
+
| XorShiftRandom | 766,300,000 | 554,600,000 | 586,100,000 | 181,100,000 | 259,100,000 | 443,300,000 | 393,600,000 |
|
|
96
|
+
| XoroShiroRandom | 766,200,000 | 522,900,000 | 714,100,000 | 167,200,000 | 243,300,000 | 428,400,000 | 381,000,000 |
|
|
97
|
+
| PhotonSpinRandom | 677,900,000 | 232,100,000 | 258,000,000 | 116,900,000 | 114,800,000 | 209,700,000 | 201,100,000 |
|
|
98
|
+
| StormDropRandom | 758,100,000 | 538,100,000 | 698,600,000 | 184,100,000 | 271,800,000 | 406,300,000 | 365,900,000 |
|
|
96
99
|
|
|
97
100
|
<!-- RANDOM_BENCHMARKS_END -->
|
|
98
101
|
|
|
@@ -110,8 +113,8 @@ This document contains performance benchmarks for the various random number gene
|
|
|
110
113
|
|
|
111
114
|
Based on the benchmarks:
|
|
112
115
|
|
|
113
|
-
- **For general use**: `IllusionFlow` (via `PRNG.Instance`) - Great balance of speed and quality
|
|
114
|
-
- **For maximum speed**: `
|
|
116
|
+
- **For general use**: `IllusionFlow` (via `PRNG.Instance`) or `PCG` - Great balance of speed and quality
|
|
117
|
+
- **For maximum speed**: `LinearCongruentialGenerator` - Fastest overall (but not recommended for statistical quality)
|
|
115
118
|
- **For compatibility**: `DotNetRandom` - Uses .NET's built-in Random
|
|
116
119
|
- **Avoid for performance**: `UnityRandom` - Significantly slower than alternatives
|
|
117
120
|
|
|
@@ -32,34 +32,34 @@ This document contains performance benchmarks for the 2D spatial tree implementa
|
|
|
32
32
|
|
|
33
33
|
| Construction | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
34
34
|
| ----------------- | ------------------- | --------------------- | ---------- | ---------- |
|
|
35
|
-
| 1,000,000 entries |
|
|
35
|
+
| 1,000,000 entries | 4 (0.247s) | 6 (0.158s) | 3 (0.260s) | 2 (0.371s) |
|
|
36
36
|
|
|
37
37
|
##### Elements In Range
|
|
38
38
|
|
|
39
39
|
| Elements In Range | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
40
40
|
| --------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
41
|
-
| Full (~span/2) (r=499.5) |
|
|
42
|
-
| Half (~span/4) (r=249.8) |
|
|
43
|
-
| Quarter (~span/8) (r=124.9) |
|
|
44
|
-
| Tiny (~span/1000) (r=1) |
|
|
41
|
+
| Full (~span/2) (r=499.5) | 59 | 57 | 56 | 7 |
|
|
42
|
+
| Half (~span/4) (r=249.8) | 238 | 237 | 212 | 28 |
|
|
43
|
+
| Quarter (~span/8) (r=124.9) | 946 | 947 | 810 | 117 |
|
|
44
|
+
| Tiny (~span/1000) (r=1) | 98,434 | 105,450 | 143,326 | 100,262 |
|
|
45
45
|
|
|
46
46
|
##### Get Elements In Bounds
|
|
47
47
|
|
|
48
48
|
| Get Elements In Bounds | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
49
49
|
| -------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
50
|
-
| Full (size=999.0x999.0) |
|
|
51
|
-
| Half (size=499.5x499.5) | 1,
|
|
52
|
-
| Quarter (size=249.8x249.8) |
|
|
53
|
-
| Unit (size=1) |
|
|
50
|
+
| Full (size=999.0x999.0) | 403 | 424 | 408 | 17 |
|
|
51
|
+
| Half (size=499.5x499.5) | 1,801 | 1,805 | 1,233 | 86 |
|
|
52
|
+
| Quarter (size=249.8x249.8) | 6,931 | 6,919 | 3,796 | 378 |
|
|
53
|
+
| Unit (size=1) | 144,441 | 147,676 | 190,607 | 108,770 |
|
|
54
54
|
|
|
55
55
|
##### Approximate Nearest Neighbors
|
|
56
56
|
|
|
57
57
|
| Approximate Nearest Neighbors | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
58
58
|
| ----------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
59
|
-
| 500 neighbors | 8,
|
|
60
|
-
| 100 neighbors |
|
|
61
|
-
| 10 neighbors |
|
|
62
|
-
| 1 neighbor |
|
|
59
|
+
| 500 neighbors | 8,215 | 16,455 | 12,373 | 66,023 |
|
|
60
|
+
| 100 neighbors | 71,589 | 76,394 | 76,066 | 175,563 |
|
|
61
|
+
| 10 neighbors | 396,400 | 353,706 | 232,223 | 282,978 |
|
|
62
|
+
| 1 neighbor | 515,059 | 521,836 | 289,193 | 297,522 |
|
|
63
63
|
|
|
64
64
|
#### **100,000 entries**
|
|
65
65
|
|
|
@@ -67,34 +67,34 @@ This document contains performance benchmarks for the 2D spatial tree implementa
|
|
|
67
67
|
|
|
68
68
|
| Construction | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
69
69
|
| --------------- | ------------------- | --------------------- | ----------- | ----------- |
|
|
70
|
-
| 100,000 entries |
|
|
70
|
+
| 100,000 entries | 49 (0.020s) | 84 (0.012s) | 49 (0.020s) | 49 (0.020s) |
|
|
71
71
|
|
|
72
72
|
##### Elements In Range
|
|
73
73
|
|
|
74
74
|
| Elements In Range | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
75
75
|
| --------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
76
|
-
| Full (~span/2) (r=199.5) | 602 |
|
|
77
|
-
| Half (~span/4) (r=99.75) | 1,
|
|
78
|
-
| Quarter (~span/8) (r=49.88) | 4,
|
|
79
|
-
| Tiny (~span/1000) (r=1) |
|
|
76
|
+
| Full (~span/2) (r=199.5) | 602 | 584 | 601 | 72 |
|
|
77
|
+
| Half (~span/4) (r=99.75) | 1,356 | 1,315 | 1,248 | 184 |
|
|
78
|
+
| Quarter (~span/8) (r=49.88) | 4,666 | 5,014 | 4,227 | 722 |
|
|
79
|
+
| Tiny (~span/1000) (r=1) | 123,692 | 124,176 | 177,014 | 144,611 |
|
|
80
80
|
|
|
81
81
|
##### Get Elements In Bounds
|
|
82
82
|
|
|
83
83
|
| Get Elements In Bounds | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
84
84
|
| -------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
85
|
-
| Full (size=399.0x249.0) | 4,
|
|
86
|
-
| Half (size=199.5x124.5) | 9,
|
|
87
|
-
| Quarter (size=99.75x62.25) |
|
|
88
|
-
| Unit (size=1) |
|
|
85
|
+
| Full (size=399.0x249.0) | 4,397 | 4,479 | 4,616 | 235 |
|
|
86
|
+
| Half (size=199.5x124.5) | 9,286 | 11,932 | 8,002 | 967 |
|
|
87
|
+
| Quarter (size=99.75x62.25) | 24,540 | 32,163 | 19,726 | 3,738 |
|
|
88
|
+
| Unit (size=1) | 183,028 | 184,582 | 244,412 | 152,512 |
|
|
89
89
|
|
|
90
90
|
##### Approximate Nearest Neighbors
|
|
91
91
|
|
|
92
92
|
| Approximate Nearest Neighbors | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
93
93
|
| ----------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
94
|
-
| 500 neighbors | 9,
|
|
95
|
-
| 100 neighbors | 49,
|
|
96
|
-
| 10 neighbors |
|
|
97
|
-
| 1 neighbor |
|
|
94
|
+
| 500 neighbors | 9,966 | 9,639 | 11,541 | 69,208 |
|
|
95
|
+
| 100 neighbors | 49,796 | 90,353 | 53,438 | 230,407 |
|
|
96
|
+
| 10 neighbors | 466,552 | 387,689 | 277,034 | 345,328 |
|
|
97
|
+
| 1 neighbor | 473,688 | 532,273 | 307,580 | 352,576 |
|
|
98
98
|
|
|
99
99
|
#### **10,000 entries**
|
|
100
100
|
|
|
@@ -102,34 +102,34 @@ This document contains performance benchmarks for the 2D spatial tree implementa
|
|
|
102
102
|
|
|
103
103
|
| Construction | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
104
104
|
| -------------- | ------------------- | --------------------- | ------------ | ------------ |
|
|
105
|
-
| 10,000 entries |
|
|
105
|
+
| 10,000 entries | 529 (0.002s) | 815 (0.001s) | 455 (0.002s) | 512 (0.002s) |
|
|
106
106
|
|
|
107
107
|
##### Elements In Range
|
|
108
108
|
|
|
109
109
|
| Elements In Range | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
110
110
|
| --------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
111
|
-
| Full (~span/2) (r=49.50) | 5,
|
|
112
|
-
| Half (~span/4) (r=24.75) | 22,
|
|
113
|
-
| Quarter (~span/8) (r=12.38) | 44,
|
|
114
|
-
| Tiny (~span/1000) (r=1) | 167,
|
|
111
|
+
| Full (~span/2) (r=49.50) | 5,942 | 5,947 | 5,797 | 734 |
|
|
112
|
+
| Half (~span/4) (r=24.75) | 22,301 | 22,284 | 13,857 | 2,923 |
|
|
113
|
+
| Quarter (~span/8) (r=12.38) | 44,114 | 51,456 | 36,995 | 12,213 |
|
|
114
|
+
| Tiny (~span/1000) (r=1) | 167,221 | 162,154 | 233,341 | 166,907 |
|
|
115
115
|
|
|
116
116
|
##### Get Elements In Bounds
|
|
117
117
|
|
|
118
118
|
| Get Elements In Bounds | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
119
119
|
| -------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
120
|
-
| Full (size=99.00x99.00) | 45,
|
|
121
|
-
| Half (size=49.50x49.50) | 167,
|
|
122
|
-
| Quarter (size=24.75x24.75) |
|
|
123
|
-
| Unit (size=1) |
|
|
120
|
+
| Full (size=99.00x99.00) | 45,269 | 43,416 | 46,564 | 2,420 |
|
|
121
|
+
| Half (size=49.50x49.50) | 167,232 | 141,687 | 36,664 | 9,265 |
|
|
122
|
+
| Quarter (size=24.75x24.75) | 75,491 | 101,011 | 73,844 | 34,489 |
|
|
123
|
+
| Unit (size=1) | 240,188 | 227,996 | 309,160 | 174,684 |
|
|
124
124
|
|
|
125
125
|
##### Approximate Nearest Neighbors
|
|
126
126
|
|
|
127
127
|
| Approximate Nearest Neighbors | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
128
128
|
| ----------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
129
|
-
| 500 neighbors | 13,
|
|
130
|
-
| 100 neighbors | 62,
|
|
131
|
-
| 10 neighbors |
|
|
132
|
-
| 1 neighbor |
|
|
129
|
+
| 500 neighbors | 13,200 | 13,025 | 14,094 | 62,841 |
|
|
130
|
+
| 100 neighbors | 62,347 | 57,224 | 94,155 | 234,789 |
|
|
131
|
+
| 10 neighbors | 417,844 | 385,871 | 306,896 | 415,602 |
|
|
132
|
+
| 1 neighbor | 597,726 | 605,838 | 372,639 | 428,203 |
|
|
133
133
|
|
|
134
134
|
#### **1,000 entries**
|
|
135
135
|
|
|
@@ -137,34 +137,34 @@ This document contains performance benchmarks for the 2D spatial tree implementa
|
|
|
137
137
|
|
|
138
138
|
| Construction | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
139
139
|
| ------------- | ------------------- | --------------------- | -------------- | -------------- |
|
|
140
|
-
| 1,000 entries | 4,
|
|
140
|
+
| 1,000 entries | 4,083 (0.000s) | 5,184 (0.000s) | 5,015 (0.000s) | 4,734 (0.000s) |
|
|
141
141
|
|
|
142
142
|
##### Elements In Range
|
|
143
143
|
|
|
144
144
|
| Elements In Range | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
145
145
|
| -------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
146
|
-
| Full (~span/2) (r=24.50) | 58,
|
|
147
|
-
| Half (~span/4) (r=12.25) | 60,
|
|
148
|
-
| Quarter (~span/8) (r=6.13) | 95,
|
|
149
|
-
| Tiny (~span/1000) (r=1) |
|
|
146
|
+
| Full (~span/2) (r=24.50) | 58,157 | 57,216 | 55,735 | 7,410 |
|
|
147
|
+
| Half (~span/4) (r=12.25) | 60,401 | 74,867 | 55,646 | 14,536 |
|
|
148
|
+
| Quarter (~span/8) (r=6.13) | 95,855 | 104,856 | 92,720 | 36,861 |
|
|
149
|
+
| Tiny (~span/1000) (r=1) | 238,667 | 226,635 | 330,912 | 246,972 |
|
|
150
150
|
|
|
151
151
|
##### Get Elements In Bounds
|
|
152
152
|
|
|
153
153
|
| Get Elements In Bounds | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
154
154
|
| ------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
155
|
-
| Full (size=49.00x19.00) | 499,
|
|
156
|
-
| Half (size=24.50x9.5) |
|
|
157
|
-
| Quarter (size=12.25x4.75) |
|
|
158
|
-
| Unit (size=1) |
|
|
155
|
+
| Full (size=49.00x19.00) | 499,140 | 499,234 | 428,783 | 24,121 |
|
|
156
|
+
| Half (size=24.50x9.5) | 166,826 | 285,095 | 125,435 | 74,946 |
|
|
157
|
+
| Quarter (size=12.25x4.75) | 269,508 | 278,944 | 192,644 | 175,535 |
|
|
158
|
+
| Unit (size=1) | 339,865 | 325,878 | 430,380 | 279,436 |
|
|
159
159
|
|
|
160
160
|
##### Approximate Nearest Neighbors
|
|
161
161
|
|
|
162
162
|
| Approximate Nearest Neighbors | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
163
163
|
| ----------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
164
|
-
| 500 neighbors |
|
|
165
|
-
| 100 neighbors | 80,
|
|
166
|
-
| 10 neighbors |
|
|
167
|
-
| 1 neighbor | 754,
|
|
164
|
+
| 500 neighbors | 44,952 | 44,992 | 39,051 | 70,210 |
|
|
165
|
+
| 100 neighbors | 80,437 | 75,964 | 89,052 | 271,927 |
|
|
166
|
+
| 10 neighbors | 489,189 | 560,687 | 410,907 | 497,753 |
|
|
167
|
+
| 1 neighbor | 754,167 | 586,966 | 400,770 | 571,875 |
|
|
168
168
|
|
|
169
169
|
#### **100 entries**
|
|
170
170
|
|
|
@@ -172,33 +172,33 @@ This document contains performance benchmarks for the 2D spatial tree implementa
|
|
|
172
172
|
|
|
173
173
|
| Construction | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
174
174
|
| ------------ | ------------------- | --------------------- | --------------- | --------------- |
|
|
175
|
-
| 100 entries |
|
|
175
|
+
| 100 entries | 39,682 (0.000s) | 24,213 (0.000s) | 25,839 (0.000s) | 21,598 (0.000s) |
|
|
176
176
|
|
|
177
177
|
##### Elements In Range
|
|
178
178
|
|
|
179
179
|
| Elements In Range | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
180
180
|
| -------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
181
|
-
| Full (~span/2) (r=4.5) |
|
|
182
|
-
| Half (~span/4) (r=2.25) |
|
|
183
|
-
| Quarter (~span/8) (r=1.13) |
|
|
184
|
-
| Tiny (~span/1000) (r=1) |
|
|
181
|
+
| Full (~span/2) (r=4.5) | 502,463 | 470,481 | 510,232 | 70,387 |
|
|
182
|
+
| Half (~span/4) (r=2.25) | 414,623 | 418,953 | 256,757 | 227,109 |
|
|
183
|
+
| Quarter (~span/8) (r=1.13) | 413,902 | 419,061 | 594,832 | 328,502 |
|
|
184
|
+
| Tiny (~span/1000) (r=1) | 413,771 | 418,761 | 595,099 | 332,198 |
|
|
185
185
|
|
|
186
186
|
##### Get Elements In Bounds
|
|
187
187
|
|
|
188
188
|
| Get Elements In Bounds | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
189
189
|
| ------------------------ | ------------------- | --------------------- | ---------- | ------- |
|
|
190
|
-
| Full (size=9x9) | 2,
|
|
191
|
-
| Half (size=4.5x4.5) |
|
|
192
|
-
| Quarter (size=2.25x2.25) |
|
|
193
|
-
| Unit (size=1) |
|
|
190
|
+
| Full (size=9x9) | 2,279,797 | 2,440,244 | 2,399,399 | 222,330 |
|
|
191
|
+
| Half (size=4.5x4.5) | 566,414 | 557,022 | 365,367 | 358,174 |
|
|
192
|
+
| Quarter (size=2.25x2.25) | 586,347 | 595,738 | 781,145 | 378,042 |
|
|
193
|
+
| Unit (size=1) | 586,344 | 546,990 | 781,899 | 365,952 |
|
|
194
194
|
|
|
195
195
|
##### Approximate Nearest Neighbors
|
|
196
196
|
|
|
197
197
|
| Approximate Nearest Neighbors | KDTree2D (Balanced) | KDTree2D (Unbalanced) | QuadTree2D | RTree2D |
|
|
198
198
|
| ----------------------------- | ------------------- | --------------------- | ---------- | ------- |
|
|
199
|
-
| 100 neighbors (max) |
|
|
200
|
-
| 10 neighbors |
|
|
201
|
-
| 1 neighbor |
|
|
199
|
+
| 100 neighbors (max) | 165,518 | 148,266 | 188,796 | 303,865 |
|
|
200
|
+
| 10 neighbors | 606,013 | 409,928 | 587,065 | 727,089 |
|
|
201
|
+
| 1 neighbor | 623,002 | 744,154 | 663,384 | 809,173 |
|
|
202
202
|
|
|
203
203
|
<!-- tabs:end -->
|
|
204
204
|
<!-- SPATIAL_TREE_BENCHMARKS_END -->
|