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.
Files changed (52) hide show
  1. package/Docs/ILIST_SORTING_PERFORMANCE.md +92 -0
  2. package/Docs/ILIST_SORTING_PERFORMANCE.md.meta +7 -0
  3. package/Docs/INDEX.md +10 -1
  4. package/Docs/Images/random_generators.svg +7 -7
  5. package/Docs/RANDOM_PERFORMANCE.md +17 -14
  6. package/Docs/SPATIAL_TREE_2D_PERFORMANCE.md +64 -64
  7. package/Docs/SPATIAL_TREE_3D_PERFORMANCE.md +64 -64
  8. package/Editor/Core/Helper/AnimationEventHelpers.cs +1 -1
  9. package/README.md +25 -15
  10. package/Runtime/Core/Extension/IListExtensions.cs +720 -12
  11. package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +2 -3
  12. package/Runtime/Core/Random/AbstractRandom.cs +52 -5
  13. package/Runtime/Core/Random/DotNetRandom.cs +3 -3
  14. package/Runtime/Core/Random/FlurryBurstRandom.cs +285 -0
  15. package/Runtime/Core/Random/FlurryBurstRandom.cs.meta +3 -0
  16. package/Runtime/Core/Random/IllusionFlow.cs +3 -3
  17. package/Runtime/Core/Random/LinearCongruentialGenerator.cs +3 -3
  18. package/Runtime/Core/Random/PcgRandom.cs +6 -6
  19. package/Runtime/Core/Random/PhotonSpinRandom.cs +387 -0
  20. package/Runtime/Core/Random/PhotonSpinRandom.cs.meta +3 -0
  21. package/Runtime/Core/Random/RomuDuo.cs +3 -3
  22. package/Runtime/Core/Random/SplitMix64.cs +3 -3
  23. package/Runtime/Core/Random/SquirrelRandom.cs +6 -4
  24. package/Runtime/Core/Random/StormDropRandom.cs +271 -0
  25. package/Runtime/Core/Random/StormDropRandom.cs.meta +3 -0
  26. package/Runtime/Core/Random/UnityRandom.cs +3 -3
  27. package/Runtime/Core/Random/WyRandom.cs +6 -4
  28. package/Runtime/Core/Random/XorShiftRandom.cs +3 -3
  29. package/Runtime/Core/Random/XoroShiroRandom.cs +3 -3
  30. package/Runtime/Tags/AttributeMetadataCache.cs +312 -3
  31. package/Tests/Editor/Tags/AttributeMetadataCacheTests.cs +192 -0
  32. package/Tests/Editor/Tags/AttributeMetadataCacheTests.cs.meta +11 -0
  33. package/Tests/Editor/Tags.meta +8 -0
  34. package/Tests/Runtime/Extensions/IListExtensionTests.cs +187 -1
  35. package/Tests/Runtime/Helper/ObjectsTests.cs +3 -3
  36. package/Tests/Runtime/Integrations/Reflex/RelationalComponentsReflexTests.cs +2 -2
  37. package/Tests/Runtime/Performance/IListSortingPerformanceTests.cs +346 -0
  38. package/Tests/Runtime/Performance/IListSortingPerformanceTests.cs.meta +11 -0
  39. package/Tests/Runtime/Performance/RandomPerformanceTests.cs +3 -0
  40. package/Tests/Runtime/Random/FlurryBurstRandomTests.cs +12 -0
  41. package/Tests/Runtime/Random/FlurryBurstRandomTests.cs.meta +3 -0
  42. package/Tests/Runtime/Random/PhotonSpinRandomTests.cs +12 -0
  43. package/Tests/Runtime/Random/PhotonSpinRandomTests.cs.meta +3 -0
  44. package/Tests/Runtime/Random/RandomProtoSerializationTests.cs +14 -0
  45. package/Tests/Runtime/Random/RandomTestBase.cs +39 -4
  46. package/Tests/Runtime/Random/StormDropRandomTests.cs +12 -0
  47. package/Tests/Runtime/Random/StormDropRandomTests.cs.meta +3 -0
  48. package/Tests/Runtime/Serialization/ProtoInterfaceResolutionEdgeTests.cs +2 -2
  49. package/Tests/Runtime/Serialization/ProtoRootRegistrationTests.cs +1 -1
  50. package/Tests/Runtime/Serialization/ProtoSerializeBehaviorTests.cs +1 -1
  51. package/Tests/Runtime/Tags/PeriodicEffectDefinitionSerializationTests.cs +2 -2
  52. 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 -->
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 472ebf17c174498daf3ef01bda2a8c6b
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
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** - 12 high-performance PRNG implementations
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="276" r="2"/>
85
+ <circle cx="424" cy="272" r="2"/>
86
86
  <circle cx="450" cy="260" r="2"/>
87
- <circle cx="452" cy="268" r="2"/>
88
- <circle cx="458" cy="276" r="2"/>
89
- <circle cx="480" cy="260" r="2"/>
90
- <circle cx="490" cy="260" r="2"/>
91
- <circle cx="480" cy="276" r="2"/>
92
- <circle cx="490" cy="276" r="2"/>
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 | 550,600,000 | 53,100,000 | 57,400,000 | 45,600,000 | 26,900,000 | 53,700,000 | 53,900,000 |
85
- | LinearCongruentialGenerator | 814,800,000 | 538,900,000 | 1,335,100,000 | 184,700,000 | 296,500,000 | 591,500,000 | 508,400,000 |
86
- | IllusionFlow | 800,200,000 | 489,500,000 | 892,600,000 | 167,600,000 | 268,200,000 | 444,600,000 | 396,100,000 |
87
- | PcgRandom | 796,400,000 | 537,900,000 | 889,500,000 | 184,300,000 | 291,400,000 | 456,500,000 | 412,000,000 |
88
- | RomuDuo | 794,300,000 | 359,300,000 | 766,200,000 | 167,200,000 | 191,600,000 | 446,000,000 | 397,600,000 |
89
- | SplitMix64 | 801,100,000 | 537,400,000 | 972,300,000 | 183,800,000 | 296,600,000 | 487,500,000 | 446,600,000 |
90
- | SquirrelRandom | 747,700,000 | 383,300,000 | 413,800,000 | 172,300,000 | 204,800,000 | 330,200,000 | 314,200,000 |
91
- | SystemRandom | 146,800,000 | 148,300,000 | 65,700,000 | 132,500,000 | 139,500,000 | 59,800,000 | 61,300,000 |
92
- | UnityRandom | 647,700,000 | 77,800,000 | 87,800,000 | 62,100,000 | 39,500,000 | 81,500,000 | 82,400,000 |
93
- | WyRandom | 750,700,000 | 382,900,000 | 447,500,000 | 166,800,000 | 191,700,000 | 296,800,000 | 281,100,000 |
94
- | XorShiftRandom | 792,900,000 | 536,400,000 | 606,000,000 | 184,100,000 | 287,300,000 | 442,800,000 | 391,200,000 |
95
- | XoroShiroRandom | 789,200,000 | 359,300,000 | 715,100,000 | 167,300,000 | 192,500,000 | 428,900,000 | 383,500,000 |
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**: `RomuDuo` or `LinearCongruentialGenerator` - Fastest overall
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 | 3 (0.325s) | 4 (0.218s) | 4 (0.221s) | 1 (0.595s) |
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) | 58 | 58 | 56 | 7 |
42
- | Half (~span/4) (r=249.8) | 236 | 238 | 215 | 28 |
43
- | Quarter (~span/8) (r=124.9) | 945 | 946 | 815 | 119 |
44
- | Tiny (~span/1000) (r=1) | 103,233 | 105,580 | 142,838 | 107,126 |
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) | 314 | 325 | 344 | 17 |
51
- | Half (size=499.5x499.5) | 1,730 | 1,822 | 1,238 | 73 |
52
- | Quarter (size=249.8x249.8) | 7,188 | 7,170 | 3,867 | 379 |
53
- | Unit (size=1) | 149,753 | 153,363 | 197,026 | 113,010 |
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,466 | 16,873 | 12,696 | 70,046 |
60
- | 100 neighbors | 78,952 | 76,476 | 78,720 | 171,372 |
61
- | 10 neighbors | 375,484 | 377,708 | 251,988 | 277,491 |
62
- | 1 neighbor | 551,002 | 508,239 | 276,379 | 299,010 |
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 | 50 (0.020s) | 83 (0.012s) | 50 (0.020s) | 49 (0.020s) |
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 | 602 | 600 | 73 |
77
- | Half (~span/4) (r=99.75) | 1,355 | 1,359 | 1,248 | 185 |
78
- | Quarter (~span/8) (r=49.88) | 4,672 | 5,178 | 4,300 | 723 |
79
- | Tiny (~span/1000) (r=1) | 127,810 | 128,060 | 179,544 | 145,029 |
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,436 | 4,468 | 4,702 | 235 |
86
- | Half (size=199.5x124.5) | 9,433 | 11,669 | 7,996 | 967 |
87
- | Quarter (size=99.75x62.25) | 25,419 | 32,186 | 19,754 | 3,805 |
88
- | Unit (size=1) | 184,712 | 185,636 | 245,390 | 155,220 |
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,986 | 9,929 | 11,705 | 69,966 |
95
- | 100 neighbors | 49,779 | 87,233 | 55,229 | 233,211 |
96
- | 10 neighbors | 470,175 | 394,286 | 294,299 | 352,517 |
97
- | 1 neighbor | 509,623 | 544,160 | 314,046 | 350,724 |
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 | 533 (0.002s) | 796 (0.001s) | 408 (0.002s) | 507 (0.002s) |
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,944 | 5,941 | 5,936 | 735 |
112
- | Half (~span/4) (r=24.75) | 22,272 | 22,233 | 13,861 | 2,919 |
113
- | Quarter (~span/8) (r=12.38) | 44,278 | 51,526 | 38,041 | 12,217 |
114
- | Tiny (~span/1000) (r=1) | 167,798 | 162,582 | 223,371 | 168,224 |
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,222 | 44,244 | 47,466 | 2,412 |
121
- | Half (size=49.50x49.50) | 167,135 | 166,097 | 36,985 | 9,274 |
122
- | Quarter (size=24.75x24.75) | 76,007 | 104,425 | 74,227 | 35,573 |
123
- | Unit (size=1) | 242,092 | 234,546 | 320,164 | 181,677 |
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,178 | 12,888 | 14,441 | 65,299 |
130
- | 100 neighbors | 62,415 | 57,120 | 96,738 | 235,553 |
131
- | 10 neighbors | 418,552 | 392,340 | 316,886 | 420,625 |
132
- | 1 neighbor | 595,519 | 632,000 | 372,667 | 433,485 |
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,672 (0.000s) | 5,611 (0.000s) | 4,847 (0.000s) | 4,764 (0.000s) |
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,142 | 56,029 | 57,082 | 7,394 |
147
- | Half (~span/4) (r=12.25) | 60,439 | 76,572 | 57,123 | 14,698 |
148
- | Quarter (~span/8) (r=6.13) | 95,988 | 108,457 | 95,703 | 37,920 |
149
- | Tiny (~span/1000) (r=1) | 239,460 | 237,275 | 333,071 | 251,518 |
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,193 | 498,444 | 508,596 | 24,141 |
156
- | Half (size=24.50x9.5) | 167,532 | 291,283 | 126,274 | 75,139 |
157
- | Quarter (size=12.25x4.75) | 271,878 | 288,421 | 194,135 | 176,768 |
158
- | Unit (size=1) | 342,402 | 339,166 | 460,883 | 281,383 |
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 | 46,434 | 47,214 | 40,048 | 70,543 |
165
- | 100 neighbors | 80,837 | 77,933 | 91,884 | 267,760 |
166
- | 10 neighbors | 487,252 | 574,172 | 426,710 | 516,096 |
167
- | 1 neighbor | 754,604 | 618,120 | 404,966 | 594,659 |
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 | 37,174 (0.000s) | 3,938 (0.000s) | 10,384 (0.000s) | 21,978 (0.000s) |
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) | 505,197 | 462,582 | 480,895 | 72,679 |
182
- | Half (~span/4) (r=2.25) | 428,579 | 432,700 | 256,227 | 233,286 |
183
- | Quarter (~span/8) (r=1.13) | 422,859 | 432,362 | 601,655 | 318,360 |
184
- | Tiny (~span/1000) (r=1) | 406,482 | 433,055 | 601,161 | 339,515 |
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,460,211 | 2,459,261 | 2,542,373 | 223,694 |
191
- | Half (size=4.5x4.5) | 572,726 | 561,349 | 365,082 | 372,098 |
192
- | Quarter (size=2.25x2.25) | 594,157 | 580,857 | 738,232 | 396,288 |
193
- | Unit (size=1) | 593,669 | 576,995 | 787,477 | 395,564 |
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) | 166,728 | 165,861 | 199,072 | 303,148 |
200
- | 10 neighbors | 610,079 | 520,568 | 639,716 | 735,646 |
201
- | 1 neighbor | 457,409 | 765,967 | 667,953 | 818,651 |
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 -->