runtime: PipeOptions, StreamPipeReaderOptions, and StreamPipeWriterOptions should not hardcode default sizes.

As per the title, PipeOptions, StreamPipeReaderOptions, and StreamPipeWriterOptions should be updated so that the default sizes (such as the buffer size) are not hardcoded. The current values are based on profiling data and that may change in the future based on additional profiling data or customer feedback.

Changing it to not be hardcoded leaves the default buffer size an implementation detail that can be configured per runtime/os/etc and so that it can be freely changed under the covers if needed/desired.

There is prior art to using -1 or 0 as the default. -1 gives more flexibility since it is always an invalid size and 0 may be desirable for other scenarios (such as saying “don’t do any buffering”). Another alternative is to use Nullable<T>.

This currently looks to apply to:

PipeOptions.PauseWriterThreshold
PipeOptions.ResumeWriterThreshold
PipeOptions.MinimumSegmentSize
StreamPipeReaderOptions.BufferSize
StreamPipeReaderOptions.MinimumReadSize
StreamPipeWriterOptions.MinimumBufferSize

After construction, the properties should reflect the actual default.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

Should we use int? instead of a sentinel value or is that overkill here?