Skip to content

HotSpot[ByteStream]: Split ByteStream into Reader and Writer #702

@ColinLeeo

Description

@ColinLeeo

ByteStream is currently used for two fundamentally different purposes:
(1) a write-oriented, growable buffer optimized for encoding and frequent small writes, and
(2) a read-only wrapper over an existing buffer via wrap_from().
These two usages have very different requirements, but are implemented in a single class.

This mixed design complicates the implementation and blocks write-side optimizations such as fixed (power-of-two) page sizes and compile-time specialization, while also forcing the read path to carry unnecessary paging and write-related state. Splitting ByteStream into explicit Reader and Writer types clarifies responsibilities, simplifies invariants, and enables better performance and maintainability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions