-
Notifications
You must be signed in to change notification settings - Fork 273
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 a JsonNode roundtrip benchmark #2714
Add a JsonNode roundtrip benchmark #2714
Conversation
if (!IsDataIndented) | ||
{ | ||
_dataUtf8 = DocumentHelpers.RemoveFormatting(jsonString); | ||
} | ||
else | ||
{ | ||
_dataUtf8 = Encoding.UTF8.GetBytes(jsonString); | ||
} |
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.
if (!IsDataIndented) | |
{ | |
_dataUtf8 = DocumentHelpers.RemoveFormatting(jsonString); | |
} | |
else | |
{ | |
_dataUtf8 = Encoding.UTF8.GetBytes(jsonString); | |
} | |
_dataUtf8 = IsDataIndented ? | |
Encoding.UTF8.GetBytes(jsonString) : | |
DocumentHelpers.RemoveFormatting(jsonString); |
?
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.
Initialization code is copypasta'd from the equivalent JsonDocument
benchmark (also called ParseThenWrite.cs
).
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.
Initialization code is copypasta'd from the equivalent
FWIW Setup and cleanup code can be always refactored and improved (duplicated code moved to helper type), as changing it typically does not affect the benchmark itself
We don't have any benchmarks tracking
JsonNode
performance, adding one here. Should help us catch performance regressions like the one reported in dotnet/runtime#78089..NET 7
.NET 8 (after fix)