dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.38k stars 4.75k forks source link

[STJ] PooledBufferWriter unnecessarily clears its buffers on every flush operation. #109979

Open eiriktsarpalis opened 4 hours ago

eiriktsarpalis commented 4 hours ago
          I've refactored the code following Miha's suggestion, but it seems STJ is susceptible to the same issue. Effectively, the buffer is being cleared every time we flush to the underlying stream.

https://github.com/dotnet/runtime/blob/d4516bf13c0a06d955912c15e71a13e3dc894db0/src/libraries/Common/src/System/Text/Json/PooledByteBufferWriter.cs#L108

I'll file an issue.

_Originally posted by @eiriktsarpalis in https://github.com/dotnet/runtime/pull/109832#discussion_r1849009395_

dotnet-policy-service[bot] commented 4 hours ago

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis See info in area-owners.md if you want to be subscribed.