stream: limit iter from sync iterable batches#63324
Open
trivikr wants to merge 2 commits into
Open
Conversation
Bound sync iterable normalization in from() and fromSync() to FROM_BATCH_SIZE. This avoids unbounded batches for from() sync iterable fallbacks and lets fromSync() coalesce plain Uint8Array values for writev paths. Signed-off-by: Kamat, Trivikram <[email protected]> Assisted-by: openai:gpt-5.5
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63324 +/- ##
==========================================
- Coverage 90.04% 90.02% -0.03%
==========================================
Files 714 714
Lines 225338 225377 +39
Branches 42598 42610 +12
==========================================
- Hits 202897 202886 -11
- Misses 14236 14267 +31
- Partials 8205 8224 +19
🚀 New features to boost your workflow:
|
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.
Description
This updates
stream/iternormalization to use bounded batches for synciterable input.
from()no longer batches sync iterables into one unbounded batch. Instead, itflushes at
FROM_BATCH_SIZE, improving first-batch latency and bounding peakbatch memory.
fromSync()now also coalesces plainUint8Arrayvalues fromsync iterables into bounded batches, allowing
pipeToSync()to usewritevSyncfor those sources.
Benchmarks
Results showed statistically significant first-batch latency improvements for
from(syncIterable):The benchmark also showed a +6.91%
writevSyncimprovement for the 256 chunkcase. The 4096 chunk writev result was not statistically significant.
Assisted-by: openai:gpt-5.5