Skip to content

Conversation

iCharlesHu
Copy link
Contributor

Currently, Subprocess always uses the same buffer size (system page size). This is an issue for executables with small but frequent outputs because Subprocess will always wait until it gathers buffer-size-bytes before it returns the read byte., causing streaming delays. Introduce the preferredBufferSize parameter to allow buffer size customization. Developers could choose a smaller buffer size if they anticipate that the output from the executable will be small.

resolves: #39

Copy link
Contributor

@jakepetroules jakepetroules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than the docs typo (or parameter name type).

@iCharlesHu iCharlesHu force-pushed the charles/adjustable-buffer-size branch from d10db98 to 5c773e0 Compare September 3, 2025 04:42
@iCharlesHu iCharlesHu merged commit e20e387 into swiftlang:main Sep 3, 2025
38 of 39 checks passed
@iCharlesHu iCharlesHu deleted the charles/adjustable-buffer-size branch September 3, 2025 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Processes with small and infrequent output doesn't get emitted in a timely manner when using sequence to capture the output
2 participants