Skip to content
Open
Changes from 3 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
20 changes: 20 additions & 0 deletions src/benchmarks/micro/libraries/System.Memory/ReadOnlySpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,26 @@ public static IEnumerable<object> TrimArguments()
yield return "abcdefg";
}

[Benchmark]
[ArgumentsSource(nameof(IsWhiteSpaceArguments))]
[MemoryRandomization]
public bool IsWhiteSpace(string input) => input.AsSpan().IsWhiteSpace();

public static IEnumerable<object> IsWhiteSpaceArguments()
{
yield return "";
yield return "0abcdefg";
yield return " 1abcdefg";
yield return " 2abcdefg";
yield return " 4abcdefg";
yield return " 6abcdefg";
yield return " 7abcdefg";
yield return " 8abcdefg";
yield return " 9abcdefg";
yield return " 16abcdefg";
yield return " 32abcdefg";
}

private static string GenerateInputString(char source, int count, char replaceChar, int replacePos)
{
char[] str = new char[count];
Expand Down
Loading