Skip to content

Optimize Quaternary collections; update README#187

Merged
ChrisPulman merged 2 commits intomainfrom
ExtendFunctionality
Feb 1, 2026
Merged

Optimize Quaternary collections; update README#187
ChrisPulman merged 2 commits intomainfrom
ExtendFunctionality

Conversation

@ChrisPulman
Copy link
Owner

Improve performance and memory usage in QuaternaryList and QuaternaryDictionary by leveraging CollectionsMarshal, Span/AsSpan, ArrayPool and ArrayPool-backed bucketization, plus parallelized shard inserts and reduced allocations. Introduces System.Runtime.InteropServices usage and ref-based value assignments (GetValueRefOrAddDefault) to avoid double lookups. Refactors bucket counting/indices to use localized arrays/spans and updates contains/CopyTo paths to use CollectionsMarshal for zero-allocation iteration.

Massively expand README with comprehensive QuaternaryList/QuaternaryDictionary documentation: features, benchmarks, API references, usage and migration guides from DynamicData, reactive stream examples, an AddressBook sample (cleaned up and modernized), and performance tips. Overall: runtime and allocation optimizations in code, and extensive docs and examples for users.

Add a new internal QuadDictionary (NET8+), a pooled, high-performance hash table using ArrayPool for entries/buckets and custom GetValueRefOrAddDefault/GetKeys/GetValues APIs. Update QuaternaryDictionary to use QuadDictionary instances instead of Dictionary, replacing CollectionsMarshal calls with the new direct-ref APIs and switching .Keys/.Values access to GetKeys/GetValues. Update README benchmark numbers accordingly. These changes aim to reduce allocations and improve lookup/insertion performance.

Improve performance and memory usage in QuaternaryList and QuaternaryDictionary by leveraging CollectionsMarshal, Span/AsSpan, ArrayPool and ArrayPool-backed bucketization, plus parallelized shard inserts and reduced allocations. Introduces System.Runtime.InteropServices usage and ref-based value assignments (GetValueRefOrAddDefault) to avoid double lookups. Refactors bucket counting/indices to use localized arrays/spans and updates contains/CopyTo paths to use CollectionsMarshal for zero-allocation iteration.

Massively expand README with comprehensive QuaternaryList/QuaternaryDictionary documentation: features, benchmarks, API references, usage and migration guides from DynamicData, reactive stream examples, an AddressBook sample (cleaned up and modernized), and performance tips. Overall: runtime and allocation optimizations in code, and extensive docs and examples for users.
Add a new QuadDictionary (NET8+), a pooled, high-performance hash table using ArrayPool for entries/buckets and custom GetValueRefOrAddDefault/GetKeys/GetValues APIs. Update QuaternaryDictionary to use QuadDictionary instances instead of Dictionary, replacing CollectionsMarshal calls with the new direct-ref APIs and switching .Keys/.Values access to GetKeys/GetValues. Update README benchmark numbers accordingly. These changes aim to reduce allocations and improve lookup/insertion performance.
@ChrisPulman ChrisPulman merged commit ea521bf into main Feb 1, 2026
1 check passed
@ChrisPulman ChrisPulman deleted the ExtendFunctionality branch February 1, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant