Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorize System.Collections.Generic.Dictionary #110701

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

kg
Copy link
Member

@kg kg commented Dec 13, 2024

A lot of the libraries tests still fail on my machine even on a fresh checkout of main, so this is to see how many regressions this actually produces.

Locally at present System.Collections.Tests has a total of 4 failures (in the concurrent modification detection, because the old way of corrupting the dictionary doesn't work anymore.)

@kg kg added NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) NO-REVIEW Experimental/testing PR, do NOT review it labels Dec 13, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-collections
See info in area-owners.md if you want to be subscribed.

@kg
Copy link
Member Author

kg commented Dec 13, 2024

Looks like scalar suffix search is broken somehow, but the vectorized suffix search appears to work on wasm and arm64.

@kg
Copy link
Member Author

kg commented Dec 13, 2024

PartitionedRateLimiterTests.Create_PassedInEqualityComparerIsUsed is asserting that we don't call GetHashCode when TryGetValue is invoked on an empty Dictionary. The other assertions in it will potentially break too since vectorized dictionary doesn't cache full hashcodes.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/libraries/System.Collections/tests/Generic/Dictionary/HashCollisionScenarios/OutOfBoundsRegression.cs:320

  • Changing the loop condition to iterate until _collidingStrings.Count may cause an IndexOutOfRangeException if _collidingStrings has fewer elements than expected. Ensure _collidingStrings has at least 110 elements before this loop.
for (int i = 100; i < _collidingStrings.Count; i++)

Tip: Turn on automatic Copilot reviews for this repository to get quick feedback on every pull request. Learn more

@@ -364,7 +364,8 @@ public void ComparerImplementations_Dictionary_WithWellKnownStringComparers()
() => GetStringHashCodeOpenDelegate("GetNonRandomizedHashCodeOrdinalIgnoreCase"));

// n.b., must be initialized *after* delegate fields above
private static readonly List<string> _collidingStrings = GenerateCollidingStrings(110);
// FIXME: This can't generate more than 124 colliding strings
Copy link
Preview

Copilot AI Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment indicates a limitation in the GenerateCollidingStrings method. Ensure that the test cases account for this limitation or update the method to handle more cases if necessary.

This comment was generated based on a coding guideline created by a repository admin.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Collections NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) NO-REVIEW Experimental/testing PR, do NOT review it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant