Skip to content

Implemented SegmentedWriter #65

@streamich

Description

@streamich

Now when Writer runs out of space, it allocates a new 2x larger buffer an copies all the memory. Instead implemented as SegmentedWriter:

  • SHOUL implement the same public API: class SegmentedWriter implements Writer.
  • Introduce segments in the writer, distinct disjoint buffers. When SegmentedWriter runs out of space it allocates a new segment, which is 2x larger than the last un-flushed segment in the buffer. The segment is appended to the segment list this.segments.push(u8), not concatenated bit buffered data.
  • Join the buffers only on .flush().
  • The .x (and other public APIs) should still work the same as in Writer.
  • Take special care to test methods that operate across segment splits.

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