Skip to content

Investigate switching to ArrayBufferWriter impl to simplify grow logic when reading from stream in JsonSerializer #32355

Open

Description

@ahsonkhan

// todo: switch to ArrayBuffer implementation to handle and simplify the allocs?

cc @steveharter

Activity

  1. added this to the 5.0 milestone on Feb 15, 2020
  2. added
    untriaged
    on Feb 15, 2020
  3. davidfowl commented on Feb 15, 2020

    @davidfowl
    Member

    ArrayBufferWriter doesn't pool currently. That's likely a performance regression

  4. ahsonkhan commented on Feb 15, 2020

    @ahsonkhan
    ContributorAuthor

    Yep, agreed. Since this is used internally, in this case, we can consider using PooledByteBufferWriter just like what we do on the Serialize/Write side.

  5. removed
    untriaged
    on Feb 15, 2020
  6. scalablecory commented on Feb 15, 2020

    @scalablecory
    Contributor

    Consider using the ArrayBuffer we use in System.Net.

  7. ahsonkhan commented on Feb 15, 2020

    @ahsonkhan
    ContributorAuthor

    That's essentially identical to PooledByteBufferWriter, if it also implemented the IBufferWriter<byte> interface (with slightly different growth logic). We should consider merging these and having only one copy.

    internal sealed class PooledByteBufferWriter : IBufferWriter<byte>, IDisposable
    {
    private byte[] _rentedBuffer;
    private int _index;

  8. modified the milestones: 5.0.0, Future on Jun 20, 2020
  9. ahsonkhan commented on Oct 19, 2021

    @ahsonkhan
    ContributorAuthor

    The source still has the todo comment, likely worth addressing manually, or closing explicitly.

  10. added
    backlog-cleanup-candidate
    on Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Text.Jsonbacklog-cleanup-candidate

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions