-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Track JSON perf with source generation #33296
Conversation
Also address missing "type" property on TouchEvent Fixes #32357
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.
Cool! What kind of numbers do we get with this?
@@ -55,12 +58,18 @@ | |||
void SerializeLarge() | |||
=> serializedValue = JsonSerializer.Serialize(largeOrgChart); | |||
|
|||
void SerializeLargeSourceGen() |
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.
Since these are benchmarks, is it worthwhile to also track the fastest perf here which would be:
using MemoryStream ms = new();
using Utf8JsonWriter writer = new(ms);
personJsonContext.Person.Serialize!(writer, largeOrgChart);
writer.Flush();
serializeValue = Encoding.UTF8.GetString(ms.ToArray());
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.
In general, we'd like these to be good representation for what our users are doing. These benchmarks are much more useful for us to track relative performance improvements / regressions in these user scenarios rather than being absolute best-case numbers.
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.
The Serialize method is public based on the assumption that some users would want absolute-best perf and avoid some overhead of the serializer. Granted, some serializer features like max-depth handling would not be provided in this model, but do we not expect a non-trivial amount of users to want best-case perf?
We won't see any perf improvement here yet since the serializer currently requires |
Co-authored-by: Tanay Parikh <TanayParikh@users.noreply.github.com>
No description provided.