Repository navigation
perf(net): add opt-in buffered stream reads - #15
Merged
thweetkomputer merged 2 commits intoOct 15, 2026
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Large incoming payloads can already span several queued receive buffers, but
TcpStream::ReadSomereturns only the front buffer. Add opt-inReadSomeBuffered(span<byte>)so callers with a larger destination can consume the queued bytes in one await, bounded by the destination size. It waits only for initial data and returns as soon as the available queue drains. ExistingReadSomebehavior and receive-pool sizing remain unchanged.The new API preserves partial-buffer offsets, byte order, and EOF semantics. If a later buffer view fails after bytes were consumed, it returns the valid prefix and reports the error on the next read. TLS keeps its existing decrypted-read behavior. Public API comments explain caller responsibility for scheduling fairness.
Validation: Debug build with GCC 13; all five standalone CTest checks passed. CI passed all eight combinations of amd64/arm64, Clang/GCC Debug, and kernel-bypass OFF/ON, plus clang-format. The CI artifact confirms the real multishot receive and EOF assertions pass without the provided-buffer fallback. The new check uses deterministic queued backend views for cross-buffer ordering, partial reads, unchanged ordinary reads, and error handling, plus real Unix socket receives for initial waiting, prompt short reads, and EOF. This host rejects io_uring provided-buffer-ring setup with
EINVAL, so live socket checks use the runtime's existing one-shot fallback; live multishot batching performance was not measured.The EOF fixture tests queued data plus EOF deterministically, then checks real socket EOF after consuming the sent payload. This avoids the older Linux AF_UNIX multishot lost-EOF wakeup race triggered by back-to-back
sendandshutdown, while preserving coverage of data-before-EOF ordering. Assertions flush their output so any CI timeout identifies the last completed check.cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_BUILD_TYPE=Debug -DBYCORF_BUILD_EXAMPLES=OFF cmake --build build --target bycorf_tcp_buffered_read_check bycorf_connect_timer_check bycorf_connection_storage_check bycorf_backend_selection_check bycorf_task_transfer_check --parallel 4 ctest --test-dir build --output-on-failure --no-tests=error