-
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
Longer strings for string.Replace(char, char) benchmarks #2329
Conversation
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.
Notes for review.
public string Replace_Char(string text, char oldChar, char newChar) | ||
=> text.Replace(oldChar, newChar); | ||
|
||
public static IEnumerable<object[]> ReplaceArguments() |
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.
Verifyed that the method names are displayed the same way, so that the reporting tool has correlation. Is this enough to be on the safe side here?
| Method | text | oldChar | newChar | Mean | Error | StdDev |
|---------------- |--------------------- |-------- |-------- |-----------:|-----------:|----------:|
| Replace_CharNew | ----(...)---- [100] | - | + | 32.553 ns | 21.554 ns | 1.1815 ns |
| Replace_CharNew | ----(...)---- [1000] | - | + | 202.048 ns | 178.291 ns | 9.7727 ns |
| Replace_Char | Hello | a | b | 5.256 ns | 4.023 ns | 0.2205 ns |
| Replace_CharNew | Hello | a | b | 5.367 ns | 2.158 ns | 0.1183 ns |
| Replace_Char | Hello | l | ! | 17.491 ns | 4.643 ns | 0.2545 ns |
| Replace_CharNew | Hello | l | ! | 18.092 ns | 12.480 ns | 0.6841 ns |
| Replace_Char | This (...)tence [28] | i | I | 36.695 ns | 91.723 ns | 5.0277 ns |
| Replace_CharNew | This (...)tence [28] | i | I | 30.385 ns | 25.207 ns | 1.3817 ns |
| Replace_Char | This (...)tence [28] | z | y | 11.598 ns | 6.366 ns | 0.3489 ns |
| Replace_CharNew | This (...)tence [28] | z | y | 12.132 ns | 10.304 ns | 0.5648 ns |
The ones with suffix New are the methods with the ArgumentsSource, the other ones with Arguments only (as in main-branch).
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.
@adamsitnik @DrewScoggins can you confirm this won't reset the results?
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.
Sorry, I thought I had already responded here. As long as the test name or the arguments have not changed values we should have no issues here. And from what I can tell nothing has changed for the existing test cases. So this LGTM.
Co-authored-by: Dan Moseley <[email protected]>
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 once we get an answer to q above. thanks for adding these.
Cf. dotnet/runtime#67049 (comment)
/cc: @danmoseley