Skip to content

Modify Utf8JsonReader Comments perf test (reduce test name size and make output clearer). - #551

Open
ahsonkhan wants to merge 1 commit into
dotnet:mainfrom
ahsonkhan:UpdateCommentTests
Open

ahsonkhan wants to merge 1 commit into
dotnet:mainfrom
ahsonkhan:UpdateCommentTests

Conversation

@ahsonkhan

Copy link
Copy Markdown
Contributor

From #543 (comment)

Primarily to make the output more reasonable to read and to remove the redundant Utf8JsonReader within the fully qualified test name (especially for the result comparer view - dotnet/corefx#38036 (comment)):
System.Text.Json.Tests.Utf8JsonReaderCommentsTests.Utf8JsonReaderCommentParsing

Also, trying to be consistent with the other perf test format.

cc @krwq, @adamsitnik

{
_jsonPayloadSequence = GetSequence(_jsonPayload, SegmentSize);
}
_jsonPayloadSequence = GetSequence(_jsonPayload, 100);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you've mentioned 4096 would be a better test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should re-consider the test, sure, but I am primarily making a cosmetic change here.


[Benchmark]
public void Utf8JsonReaderCommentParsing()
public void EmptyLoop()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConsumeAll perhaps

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. However, we don't really "consume". I would think consume to mean observing each token (either via reader.ValueSpan or reader.GetString/GetInt/etc.)

@krwq krwq Jun 10, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for me, reading is consuming (also matches naming convention used in the product). on the other hand for me empty loop means:

while (true) {}

{
var state = new JsonReaderState(options: new JsonReaderOptions { CommentHandling = CommentHandling });
Utf8JsonReader reader = MultiSegment ?
Utf8JsonReader reader = !SingleSegment ?

@krwq krwq Jun 8, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also swap expressions and remove !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

{
[BenchmarkCategory(Categories.CoreFX, Categories.JSON)]
public partial class Utf8JsonReaderCommentsTests
public partial class Utf8JsonReader_Comments

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe would be better to put Utf8JsonReader somewhere in the namespace and making a class name just CommentsTests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that, but then the test namespace doesn't follow the API namespace structure. I believe I was told that the pattern is <API name space>.Tests.

@krwq

krwq commented Jun 8, 2019

Copy link
Copy Markdown
Member

I think it was my antivirus before which was causing the weird perf results 🤦‍♂️

@billwert

Copy link
Copy Markdown
Contributor

@ahsonkhan @adamsitnik @krwq is this ready?

@krwq

krwq commented Jun 27, 2019

Copy link
Copy Markdown
Member

nothing blocking on my side, would be nice if we've addressed the feedback though. @ahsonkhan, have time to address it?

@ahsonkhan

Copy link
Copy Markdown
Contributor Author

I'll try to do an update today before I leave. Thanks for the reminder.

@adamsitnik

Copy link
Copy Markdown
Member

@ahsonkhan ping

Base automatically changed from master to main March 18, 2021 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants