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

Add AVX2 support to IndexOfAnyValues #78863

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libraries/System.Memory/tests/Span/IndexOfAnyValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ static int LastIndexOfAnyExceptReferenceImpl(ReadOnlySpan<char> searchSpace, Rea
private static class IndexOfAnyValuesTestHelper
{
private const int MaxNeedleLength = 10;
private const int MaxHaystackLength = 40;
private const int MaxHaystackLength = 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does this number come from?

Copy link
Member Author

Choose a reason for hiding this comment

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

These are used by the test when running a few million random inputs through the implementation to check random edge cases.
This number should be large enough so that we test all sorts of code paths - e.g. 100 is enough for

// Process the input with 2 Vector256s (32 chars) at a time.
+
// Process the input with 2 Vector256s (32 chars) at a time.
+
// Process the last 1-32 chars with 2 overlapped Vector256s.

so if the "2 Vector256s at a time" step left something broken, we'd catch it.

On the other hand it doesn't make sense to increase it too much as we'd just end up testing fewer variants of short inputs - and there's nothing in the code that would behave fundamentally differently for inputs of 1k vs 10k characters.


private static readonly char[] s_randomAsciiChars;
private static readonly char[] s_randomLatin1Chars;
Expand Down
Loading