Skip to content

new feature: let Go Reader return available bytes without filling every caller buffer #8249

Description

@Xuanwo

Feature Description

Improve progressive-stream latency by separating normal Read behavior from explicitly buffered bulk consumption.

Problem and Solution

The Go Reader loops over native reads until the caller buffer is full, EOF occurs, or an error arrives. The underlying Rust reader can already return available bytes, but this loop may withhold them while waiting for more data. Large destination buffers can therefore delay application processing.

Consider returning available bytes after a native read, while using an explicit bulk-copy path for throughput-oriented aggregation. Simply removing the loop may increase Go-level calls, so evaluate latency and CPU together.

Acceptance criteria:

  • A controlled reader with an available prefix and blocked subsequent data returns the prefix promptly.
  • Preserve documented read semantics, partial-read/error ordering, EOF, Seek, and Close.
  • Cover small and large buffers and slow consumers.
  • Evaluate alongside Reader.WriteTo so improved first-byte latency does not unnecessarily inflate calls for bulk transfers.

Additional Context

Loop that fills the destination; Underlying asynchronous read

This is a generic binding API improvement request. A service-specific defect or an end-to-end S3 speedup is not asserted.

Source references are pinned to b6cf44f7b8a1523409e0e998e478c996ac970f03. This request describes an optimization opportunity; it does not claim a measured end-to-end speedup.

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions