Repository navigation
Add more specialized frozen collection types. - #79794
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-collections Issue Details
FrozenDictionary/Set each have some constants defined to drive the heuristics that decide when to use the small and sparse collection types. I did some preliminary tuning of these, but this could use a detailed benchmark to pick the right values. I'll leave the fine-tuning to a separate PR.
|
|
Is there an issue approving the API - or is this intended to start discussion... |
|
@danmoseley There is no API change here, all these types are internal to the implementation of the existing frozen set and dictionary. |
- Add SmallFrozenDictionary/Set which don't do any hashing and simply iterate through arrays, testing each element - Add ClosedRangeInt32FrozenDictionary/Set which are used when the keys are in a closed integer range. - Add SparseRangeInt32FrozenSet which uses a bit vector for storage. FrozenDictionary/Set each have some constants defined to drive the heuristics that decide when to use the small and sparse collection types. I did some preliminary tuning of these, but this could use a detailed benchmark to pick the right values. I'll leave the fine-tuning to a separate PR.
| <Compile Include="System\Collections\Frozen\Int32\SmallInt32FrozenDictionary.cs" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))" /> | ||
| <Compile Include="System\Collections\Frozen\Int32\SmallInt32FrozenSet.cs" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))" /> | ||
| <Compile Include="System\Collections\Frozen\Int32\SparseRangeInt32FrozenSet.cs" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))" /> |
There was a problem hiding this comment.
These msbuild functions aren't cost-free and we usually try to not have them per compile item. Can you please move them into a separate ItemGroup? Same for the ones above (L39-43).
Add SmallFrozenDictionary/Set which don't do any hashing and simply iterate through arrays, testing each element
Add ClosedRangeInt32FrozenDictionary/Set which are used when the keys are in a closed integer range.
Add SparseRangeInt32FrozenSet which uses a bit vector for storage.
FrozenDictionary/Set each have some constants defined to drive the heuristics that decide when to use the small and sparse collection types. I did some preliminary tuning of these, but this could use a detailed benchmark to pick the right values. I'll leave the fine-tuning to a separate PR.