Skip to content
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 Utf8JsonReader.GetBoolean() benchmark #2139

Merged
merged 2 commits into from
Nov 19, 2021

Conversation

eiriktsarpalis
Copy link
Member

Add a GetBoolean() benchmark and simplify existing benchmarks in the same class. Used by dotnet/runtime#61746.

@@ -23,214 +25,189 @@ private static byte[] GetJsonBytes<T>(T elem)
return Encoding.UTF8.GetBytes(elem.ToString());
}

[Benchmark]
public byte GetByte()
[Benchmark(OperationsPerInvoke = OperationsPerBenchmark)]
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the benefit of using OperationsPerInvoke here?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

@layomia layomia left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

@eiriktsarpalis thank you for your contribution! Please see my comments for full details.

@@ -23,214 +25,189 @@ private static byte[] GetJsonBytes<T>(T elem)
return Encoding.UTF8.GetBytes(elem.ToString());
}

[Benchmark]
public byte GetByte()
[Benchmark(OperationsPerInvoke = OperationsPerBenchmark)]
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @eiriktsarpalis !

@adamsitnik adamsitnik merged commit 4666e64 into dotnet:main Nov 19, 2021
@eiriktsarpalis eiriktsarpalis deleted the utf8jsonreader-get branch November 19, 2021 15:27
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.

3 participants