-
Notifications
You must be signed in to change notification settings - Fork 272
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 BinaryWriter perf tests #1639
Conversation
/cc @adamsitnik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @GrabYourPitchforks !
{ | ||
/// <summary> | ||
/// A <see cref="Stream"/> that acts as a null sink for data. Overrides members that | ||
/// <see cref="Stream.Null"/> does not. Used for benchmarking wrappers around Stream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for adding a clear explanation why Stream.Null
is not enough 👍
|
||
public override void WriteByte(byte value) { } | ||
|
||
#if NETCOREAPP2_1_OR_GREATER // these virtual methods only exist in .NET Core 2.1+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is something new to me. Are you sure that it works outside of dotnet/runtime
? cc @ViktorHofer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@terrajobst Aren't these defines part of the latest compilers? In theory they should work in any project type in any repo, even non-MSFT code.
private char[] _inputAsChars; | ||
private BinaryWriter _bw; | ||
|
||
[Params(4, 16, 512, 10_000, 100_000, 500_000, 2_000_000)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we reduce the number of test cases to the number of different code paths? https://github.com/dotnet/performance/blob/master/docs/microbenchmark-design-guidelines.md#Code-Paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, there should be 3 different code paths. How about 32 chars, 8k chars, and 2M chars?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about 32 chars, 8k chars, and 2M chars?
👍
BTW I'm not quite sure how to debug the CI failures. Looks like a .nupkg dependency is missing in one of the legs? |
CI is a real mess right now for a bunch of reasons, not the least of which today is that there's been Nuget outages. Don't worry about it. |
Adds benchmarks for various
BinaryWriter.Write
APIs.