87 asks for reading from Span<byte> and/or Memory<byte>. That's good to have.
However, to be truly efficient when deserializing incoming data, say, in a controller method, everyone will still be implementing the loop that reads from the PipeReader and passes the span to JsonDeserializer. While it is not hard to implement, it is still non-trivial.
Or worse, people will use PipeReader.AsStream() just to get an object that they can feed to JsonDeserializer. That little in-between will copy all the data over once more.
JsonDeserializer could handle the work efficiently once and for all by implementing an async PipeReader-based overload. It would read directly from the input spans, consuming the entire PipeReader. Easy. Optimally performant.
Come to think of it, there should be a Serialize() overload that writes to a PipeWriter as well, of course.
87 asks for reading from
Span<byte>
and/orMemory<byte>
. That's good to have.However, to be truly efficient when deserializing incoming data, say, in a controller method, everyone will still be implementing the loop that reads from the
PipeReader
and passes the span toJsonDeserializer
. While it is not hard to implement, it is still non-trivial.Or worse, people will use
PipeReader.AsStream()
just to get an object that they can feed toJsonDeserializer
. That little in-between will copy all the data over once more.JsonDeserializer
could handle the work efficiently once and for all by implementing an asyncPipeReader
-based overload. It would read directly from the input spans, consuming the entirePipeReader
. Easy. Optimally performant.Come to think of it, there should be a
Serialize()
overload that writes to aPipeWriter
as well, of course.