Optimize Quaternary collections; update README#187
Merged
ChrisPulman merged 2 commits intomainfrom Feb 1, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.