-
-
Notifications
You must be signed in to change notification settings - Fork 983
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply
NoOptimization
instead of AggressiveOptimization
to loop me…
…thods. Count down loops instead of count up. Added IntroStringBuilder. Added more return type test cases.
- Loading branch information
1 parent
7080e63
commit f588b6c
Showing
21 changed files
with
235 additions
and
620 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using System.Text; | ||
|
||
namespace BenchmarkDotNet.Samples | ||
{ | ||
[MemoryDiagnoser(false)] | ||
public class IntroStringBuilder | ||
{ | ||
[Benchmark] | ||
[Arguments(1)] | ||
[Arguments(1_000)] | ||
public StringBuilder Append_Strings(int repeat) | ||
{ | ||
StringBuilder builder = new StringBuilder(); | ||
|
||
// strings are not sorted by length to mimic real input | ||
for (int i = 0; i < repeat; i++) | ||
{ | ||
builder.Append("12345"); | ||
builder.Append("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN"); | ||
builder.Append("1234567890abcdefghijklmnopqrstuvwxy"); | ||
builder.Append("1234567890"); | ||
builder.Append("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHI"); | ||
builder.Append("1234567890abcde"); | ||
builder.Append("1234567890abcdefghijklmnopqrstuvwxyzABCD"); | ||
builder.Append("1234567890abcdefghijklmnopqrst"); | ||
builder.Append("1234567890abcdefghij"); | ||
builder.Append("1234567890abcdefghijklmno"); | ||
} | ||
|
||
return builder; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 0 additions & 169 deletions
169
src/BenchmarkDotNet/Helpers/Reflection.Emit/IlGeneratorDefaultValueExtensions.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.