Skip to content

Commit

Permalink
Add benchmark with ignoreCase true and update RandomString() to not o…
Browse files Browse the repository at this point in the history
…nly generate lowercase strings.
  • Loading branch information
Drake53 authored and mmanela committed Jan 4, 2023
1 parent d30d3bd commit 70825b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Perf.DiffPlex/SideBySideDiffBuilderBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public SideBySideDiffModel BuildDiffModel()
{
return sideBySideDiffer.BuildDiffModel(oldText, newText);
}

[Benchmark]
public SideBySideDiffModel BuildDiffModelIgnoreCase()
{
return sideBySideDiffer.BuildDiffModel(oldText, newText, true, true);
}

private static string Implode<T>(IEnumerable<T> enumerable, string delim)
{
Expand Down Expand Up @@ -87,7 +93,7 @@ private static string RandomString(int maxLength)
var builder = new StringBuilder();
foreach (var i in Enumerable.Range(0, Random.Next(0, maxLength)))
{
var ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * Random.NextDouble() + 65)));
var ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * Random.NextDouble() + 32 * Random.Next(2) + 65)));
builder.Append(ch);
}

Expand Down

0 comments on commit 70825b4

Please sign in to comment.