try Suggestion from Stephen and use Write methods directly#1519
try Suggestion from Stephen and use Write methods directly#1519adamsitnik wants to merge 1 commit intoaspnet:masterfrom
Conversation
|
Does this violate the TE spec? |
It does. 1200k looks tempting, but I am afraid I should close this issue. |
|
OTOH if it could be reframed using C# source generators that would probably be ok Haven't looked to deeply at source generators, but an example of a deserializater using generators and System.Text.Json https://github.com/TomaszRewak/C-sharp-stack-only-json-parser |
|
Related issue from @jkotas dotnet/runtime#1568; not sure if using source generators for System.Json is in the 5.0 timeframe? |
|
Source generators for json serialization are not in .NET 5, unfortunately. I agree that source generators are the right way to get json serializers with best performance. Note that the source generators should be able to do even better than the handwritten json writter code. They can pre-encode constant names to save even more cycles. The pre-encoding is not convenient to do by hand, but it is very simple to do in source generator. There are other tricks that we can consider for source generators, like having special methods on json writer that skip some of the validation that is important for hand-written code, but that is unnecessary for auto-generated code. cc @steveharter |
@stephentoub +20k in JSON!
Before:
After:
With dotnet/runtime#36371
@karelz