Open annelo-msft opened 2 years ago
From our 08/04/2022 design discussion in the context of https://github.com/Azure/autorest.csharp/issues/2341 - When we sit down to rethink performance of our model serialization methods, consider using internal setters on properties, rather than creating locals during deserialization and passing them into the serialization constructor. Per @AlexanderSher, when we use structs, internal properties isn't a good idea because mutable structs are hard to use. Should be ok because structs don't have a lot of properties.
Address enum serialization: https://github.com/Azure/autorest.csharp/issues/2477#issuecomment-1198696539
One thing we shoudl explore is improving Utf8JsonContent. The type looks like it has too much indirection: both IS and HAS RequestContent. I think a better implementation would rely on something like the following: https://gist.github.com/KrzysztofCwalina/9c9d5ae7ee750fa9105fecfb0656b2da
@annelo-msft , is this https://github.com/Azure/azure-sdk-for-net/issues/31095 related?
@ArthurMa1978, it is not. That issue is about public serialization. This is about reading/writing models using internal methods.
For deserialization, a proposal is here: https://gist.github.com/annelo-msft/7d57f2d10a411750b87f0c07522dd3a2
| Method | Mean | Error | StdDev | Gen0 | Allocated |
|------------------ |---------:|---------:|---------:|-------:|----------:|
| UseUtf8JsonReader | 34.58 us | 0.681 us | 1.345 us | 2.1973 | 9.02 KB |
| UseJsonDocument | 56.78 us | 0.965 us | 0.806 us | 2.0142 | 8.43 KB |
For the August MVP, we want to achieve parity with the legacy HLC generator with regard to reading/writing models from/to wire formats. However, moving forward, we would like to take advantage of new .NET features to improve performance here.
Updated description of the design for serialization will be provided.
Related to https://github.com/Azure/autorest.csharp/issues/1614